Reputation: 111
Currently, if I go to my site...
example.com OR example.com/index.php
...I am redirected to...
example.com/
However, I would like to stop the addition of the training / when visiting the main page.
The following is my htaccess file...
IndexIgnore *
ErrorDocument 400 /error
ErrorDocument 401 /error
ErrorDocument 403 /error
ErrorDocument 404 /error
ErrorDocument 500 /error
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ / [R=301,L]
RewriteRule ^(home|cv|handouts|links|contact|copyright|cv)/?$ /index.php?module=home&action=$1
RewriteRule ^(log(in|out))/?$ /index.php?module=authentication&action=$1
RewriteRule ^photos/?$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/?$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1$&page=$2
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=item&album=$1$&page=$2&item=$3
RewriteRule ^release/?$ /index.php?module=release&action=release
RewriteRule ^error/?$ /index.php?module=error&action=error
Any ideas on how to accomplish this?
Thanks in advance!
Upvotes: 0
Views: 71
Reputation: 106916
I don't think you can do what you want.
The trailing slash in http://example.com/
is not part of the path but should rather be considered a delimiter just like the slashes in the beginning of the URL. If I enter a URL in my browser without a trailing slash the browser will actually append it to the host name before submitting a GET request for the URL. No redirection is taking place.
Upvotes: 1