Welcome Guest, Not a member yet? Register   Sign In
Redirect old URL to new URL
#1

(This post was last modified: 06-28-2015, 06:56 PM by soulcrys.)

My friend website had trouble so I code a new one for him (with Codeigniter FW, of course Smile ). His old website didnt use codeigniter. Some Old site URL are SEO and he want me redirect them to the new site.
But I cant redirect old URL to new URL. Old URL is like :

http://sample.com/?m=news&e=view&id=66

I completed remove old source in the Host. I want when someone click in that link, it will redirect to my new page:

http://sample.com/en/news/redirect-url-66.html

But idk how to do.
I tried redirect with htaccess but it didnt work because the old URL had "?" character at the stat => it alway redirect to the homepage.
Here my code
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]  
RewriteBase /
redirect 301 /?m=news&e=view&id=66  http://sample.com/en/news/redirect-url-55.html
And a member of stackoverflow help me. I work on http://htaccess.madewithlove.be/ but when I try this in codeigniter, it always redirect to homepage.
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

RewriteCond  %{QUERY_STRING} m=([a-z]+) $1
RewriteCond  %{QUERY_STRING} e=(view) $2
RewriteCond  %{QUERY_STRING} id=([0-9]+) $3
RewriteRule ^(.*)$ index.php/en/%1/redirect-url-%3.html?
Anyone could tell me what should I do?
Sorry for my bad English.
-----
Edit: I tried create a controller for that action and set that is default controller. It worked but my site_url and base_url were changed too. When I go to my page with site url: http://sample.com , it will redirect to the url I changed, how to set site_url/base_url back without default_controller ?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB