htaccess rule to forward /login/ and /login to same page?
.htaccess, apache, php, url-rewriting
Solution
Just make the trailing slash optional:
RewriteRule ^videos/login/?$ /videos/login.php
But you should better use just one variant (with or without trailing slash) and redirect one to the other:
# add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*[^/]$ /$0/ [L,R=301]
# remove trailing slash
RewriteRule (.*)/$ /$1 [L,R=301]
Problem
I have the following rule in my current .htaccess file to redirect `/videos/login/` requests to `/videos/login.php` ``` RewriteRule login/ /videos/login.php ``` This works fine if I am access login page using `http://mysite.com/videos/login/` but when I am trying to access the same page using `http://mysite.com/videos/login` (without ending slash) then it gives me "404 page not found" error. Please tell me what will be the correct rule of .htaccess file so that any request for `http://mysite.com/videos/login/` or `http://mysite.com/videos/login` will point to the same /videos/login.php page. Thanks