Results 1 to 5 of 5
  1. #1

    Why won't this code work? - RewriteCond/RewriteRule

    Why won't this code work?

    Code:
    RewriteCond %{SERVER_NAME} ^mombizboards.talkthis.com
    RewriteRule ^/(.*)$ /mombizboards/$1
    That's supposed to redirect mombizboards.talkthis.com to http://www.talkthis.com/mombizboards/ but it's supposed to keep the subdomain as the URL so it appears as if it's not installed at that directory.

    Cheers

  2. #2
    Join Date
    Jun 2005
    Posts
    697
    You need to escape . with \ afaik.
    Code:
    RewriteCond %{SERVER_NAME} ^mombizboards\.talkthis\.com
    ReflexNetworks means Happy Clients!

  3. #3
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,099
    I believe your expression is 'greedy'. Try (.*?) instead (this might not be cause of the error though, just a suggestion).
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

  4. #4
    Join Date
    Jan 2003
    Posts
    1,715
    RewriteRule is URL to FILE PATH. You need the filesystem path to your other site which, I assume, is not directly off the root directory.
    Game Servers are the next hot market!
    Slim margins, heavy support, fickle customers, and moronic suppliers!
    Start your own today!

  5. #5
    Join Date
    Aug 2005
    Location
    Canada
    Posts
    838
    Quote Originally Posted by MaxS
    Why won't this code work?

    Code:
    RewriteCond %{SERVER_NAME} ^mombizboards.talkthis.com
    RewriteRule ^/(.*)$ /mombizboards/$1
    That's supposed to redirect mombizboards.talkthis.com to http://www.talkthis.com/mombizboards/ but it's supposed to keep the subdomain as the URL so it appears as if it's not installed at that directory.

    Cheers
    Try HTTP_HOST instead of SERVER_NAME.
    Code:
    RewriteCond %{HTTP_HOST} =mombizboards.talkthis.com
    RewriteRule ^/(.*)$ /mombizboards/$1
    or
    Code:
    RewriteCond %{HTTP_HOST} ^(www\.)?mombizboards\.talkthis\.com$ [NC]
    RewriteRule ^/(.*)$ /mombizboards/$1

    Also, if it's used in .htaccess or in <Directory ..> , you need to modify it.
    Example:
    Code:
    RewriteCond %{HTTP_HOST} =mombizboards.talkthis.com
    RewriteRule !^/*mombizboards(/.*)?$ /mombizboards%{REQUEST_URI}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •