Problem with .htaccess redirect error
I'm creating a custom .htaccess redirect file and I'm running in to a strange problem
Here is my .htaccess开发者_如何学Go file rules
RewriteCond %{HTTP_HOST} !^www\.site\.com$
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ http://www.site.com/$1/ [R=301,L]
RewriteRule ^postreview/ /viewreview.php [NC,PT]
RewriteRule ^([^/\.]*)/?([^/\.]*)/?([^/\.]*)/?$ /template2.php?slash1=$1&slash2=$2&slash3=$3 [L]
To sum up what I am trying to achieve: 1. Force www 2. Have the 3 slash areas translated to variables for tempalte2.php 3. send postreview to viewreview.php
Most of what I am trying to do is working, but I have a strange bug.
When I enter "site.com/slash1" It redirect to "www.site.com/site.com/slash1/" But if I enter "site.com/slash1" it redirects to www.site.com/slash1/
For some reason it also adds a "/" to the end of everything. Not sure why..
Any ideas?
For some reason it also adds a "/" to the end of everything. Not sure why..
It's due to this rule
RewriteRule (.*)$ http://www.site.com/$1/ [R=301,L]
Change it to
RewriteRule (.*)$ http://www.site.com/$1 [R=301,L]
精彩评论