Reputation: 37
please help me with modifications .htaccess. How add ending character [/] in url.
Now .htaccess doing
www.mysite.cz/about.php > www.mysite.cz/about
www.mysite.cz/about/ > www.mysite.cz/about
i need this
www.mysite.cz/about.php > www.mysite.cz/about/
www.mysite.cz/about > www.mysite.cz/about/
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.cz$
RewriteRule (.*) http://www.mysite.cz/$1 [R=301,L]
RewriteRule ^index.php$ http://mysite.cz/$1 [R=301,L]
RewriteCond %{THE_REQUEST} \ /+(.+)(?:/|\.php)(?:\?|\ )
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /%1 [L,R=301]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^.]+)$ $1.php [L]
Upvotes: 0
Views: 81
Reputation: 41219
Try this :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.cz$
RewriteRule (.*) http://www.mysite.cz/$1 [R=301,L]
RewriteRule ^(index.php)$ http://mysite.cz/$1 [NC,R=301,L]
RewriteCond %{THE_REQUEST} \ /+(.+)(?:/|\.php)(?:\?|\ )
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /%1/ [NC,L,R=301]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^.]+)/?$ $1.php [NC,L]
This adds a trailing slash at the end of the path :
www.mydomain.cz/about.php
would redirect to
www.mydomain.cz/about/
Upvotes: 1