Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: RewriteRule - Remove trailing slash |
|
Author |
|
flatcircle
Joined: 27 Jun 2006 Posts: 79
|
Posted: Mon 28 Apr '08 16:11 Post subject: RewriteRule - Remove trailing slash |
|
|
Hello,
I want to use a Redirect to a webpage in my config.
Because I want to to redirect to a page (and not a directory), I use no trailing slash.
However, there's a possibility that a user still adds a trailing slash.
Which is the (simplest) RewriteRule-syntax to remove this trailing slash?
For example:
http://www.test.com/subdir/ to http://www.test.com/subdir
Somebody can help me out?
Regards. |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Mon 28 Apr '08 20:53 Post subject: |
|
|
#remove trailing slashes
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain\.com$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] |
|
Back to top |
|
flatcircle
Joined: 27 Jun 2006 Posts: 79
|
|
Back to top |
|
|
|
|
|
|