SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict telos's Avatar
    Join Date
    Mar 2005
    0 Post(s)
    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: --> --> --> (case-insensitive) -->

    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. (, points to, but shows

    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...

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    20 Post(s)
    3 Thread(s)

    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.


    David 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


Posting Permissions

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