Endless loop with .htaccess - HELP!

Discussion in 'Apache' started by busin3ss, Jul 12, 2006.

  1. #1
    Hi! I have the following .htaccess in my subdomain...

    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^xxx\.xxx\.com$ [NC]
    RewriteCond %{HTTP_HOST} !^$
    RewriteCond %{REQUEST_URI} ^/content($|/.*$)
    RewriteRule ^.* http://xxx.xxx.com%1 [R=301,L]
    RewriteBase /
    RewriteRule ^tag/(.*)$ tag/$1/ [R=301,L]
    RewriteRule ^tag/(.*)/$ template.php?name=$1 [L]
    RewriteRule ^feed/(.*)$ include/grouper/rsscache/$1.xml [L]
    
    Code (markup):
    I want to add the trailing slash automatically (RewriteRule ^tag/(.*)$ tag/$1/ [R=301,L]) to all the urls, but when an url is requested such as /tag/Nintendo
    It enters an endless loop that adds slashes at the end of my site and ends up like this -> /tag/Nintendo////////////////////////

    How can I fix this? Thanks in advanced!

    Also, how can I 301 all address with whitespace (%20) like /tag/Taylor%20Hicks to /tag/Taylor_Hicks, just like wikipedia when you type en.wikipedia.org/wiki/Taylor Hicks it redirects to en.wikipedia.org/Taylor_Hicks

    Thanks again guys!
     
    busin3ss, Jul 12, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    For geting %20 changed to _ editing the script is the easiest way unless

    RewriteRule ^([^.]+) ([^.]+)$ http://www.domain.com/$1_$2 [R=301,L]

    does it.
     
    Nintendo, Jul 12, 2006 IP