SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
May 25, 2005, 12:31 #1
- Join Date
- Mar 2005
- Location
- 192.168.2.34
- Posts
- 279
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
mod_rewrite: max redirects reached! Why?
Ok, I set everything to get mod_rewrite working but I think I have the actual code wrong. Everything else should be configured correctly. I get this error: Internal Server Error and my log file says that max redirects have been reached.
Here is what I have:
Options Indexes FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.])+\.example\.com$ [NC]
RewriteRule ^(.*)? /%1/$1 [L]
Here I what I want to do:
www.example.com --> example.com
johndoe.example.com --> example.com/user/profiles/johndoe
JOHNDOE.example.com --> example.com/user/profiles/johndoe (case-insensitive)
johndoe.example.com/?test=test --> example.com/user/profiles/johndoe/?test=test
Obviously, my code is wrong, but I can't figure out why, or how to fix it...
It needs to be case-insensitive and always show the subdomain and never the actual physical location. (johndoe.example.com, points to example.com/user/profiles/johndoe, but shows johndoe.example.com)
Does that make sense? You would think that with all the mod_rewrite questions and answers in here, people would be able to just look at someone elses question and figure it out...but for some reason, I cant.
Thanks in advance...
-
May 25, 2005, 17:22 #2
- Join Date
- Feb 2002
- Location
- Auckland
- Posts
- 14,692
- Mentioned
- 20 Post(s)
- Tagged
- 3 Thread(s)
telos,
Your problem is typical of the dreaded EVERYTHING atom (.*) and you should consider yourself lucky to be on an Apache 2 server 'cause your loop would have cause a lock-up of earlier servers.
For the subdirectory files, may I suggest that you use a <base href=...> tag to tell Apache where it is in relationship to the icons - OR use absolute links for those images.
Regards,
DKDavid K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Bookmarks