Remove/Unforce Trailing Slash
4 posts
• Page 1 of 1
Remove/Unforce Trailing Slash
Hi. Currently I'm forcing a trailing slash on a website.
Current rule:
# Force Trailing Slash
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R]
I'd like to start removing the trailing slash from websites. So instead of http://www.3plains.com/logos/ I'd like to have http://www.3plains.com/logos
Any help or the correct rule would be appreciated. Thanks,
Ryan
Current rule:
# Force Trailing Slash
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R]
I'd like to start removing the trailing slash from websites. So instead of http://www.3plains.com/logos/ I'd like to have http://www.3plains.com/logos
Any help or the correct rule would be appreciated. Thanks,
Ryan
Re: Remove/Unforce Trailing Slash
Hello,
Please try to use the following rule:
[ISAPI_Rewrite]
RewriteRule (.*)/ http\://$1 [RP]
Please try to use the following rule:
[ISAPI_Rewrite]
RewriteRule (.*)/ http\://$1 [RP]
Re: Remove/Unforce Trailing Slash
Anton,
I tried a few things and did get it to work with my application. Is this following code correct or is there a better way to write it?
[ISAPI_Rewrite]
# Force www
RewriteCond Host: ^mywebsite\.com
RewriteRule (.*) http\://www\.mywebsite\.com$1 [I,RP]
# Force Trailing Slash
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/])/ http\://$1$2 [I,RP]
# Pages
RewriteRule /([^.?]+[^.?/]) /code/content.php\?id=$1 [I,L]
I tried a few things and did get it to work with my application. Is this following code correct or is there a better way to write it?
[ISAPI_Rewrite]
# Force www
RewriteCond Host: ^mywebsite\.com
RewriteRule (.*) http\://www\.mywebsite\.com$1 [I,RP]
# Force Trailing Slash
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/])/ http\://$1$2 [I,RP]
# Pages
RewriteRule /([^.?]+[^.?/]) /code/content.php\?id=$1 [I,L]
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests