Welcome Guest, Not a member yet? Register   Sign In
htaccess redirect problems

I have a site made with codeigniter. The problems is that search engines have indexed it in a wrong way. Now I need to redirect all url-s without slash to url-s with slash in htacces. For instance:

/pages/en -> /pages/en/

How may I do this?


I went googling and found This.

It has these examples

Quote:The following code can be put in .htaccess to redirect URL without trailing slash to URL with trailing slash:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://YOURSITE.com/$1/ [L,R=301]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) http://www.YOURSITE.com/$1/ [R=301,L]


RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z0-9]+)/$ /$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([a-zA-Z0-9]+)
RewriteRule ^([a-zA-Z0-9]+)$ /%1/? [R=301,L]

thank you

I tried second vriant and it works

Theme © iAndrew 2016 - Forum software by © MyBB