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

[eluser]emperius[/eluser]
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?
#2

[eluser]thinkigniter[/eluser]
Hi,

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]

or

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

or

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]
#3

[eluser]emperius[/eluser]
thank you

I tried second vriant and it works




Theme © iAndrew 2016 - Forum software by © MyBB