redGREENblue
redGREENblue

Reputation: 3126

.htacess redirect

This may seem like a basic question, but I am not getting how to do it. Here is the Urls below.

Old Url : http://domain.com/index.php/items/view/item_name

New Url : http://domain.com/index.php/items/details/name/item_name

How do I do a permanent redirect with this set of old and new Urls in htaccess?

Upvotes: 1

Views: 1944

Answers (2)

anubhava
anubhava

Reputation: 784898

Put this code in your DOCUMENT_ROOT's .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(items)/view/(.*)$ /$1/details/name/$2 [NC,L,R=301]

Upvotes: 3

Roopak Venkatakrishnan
Roopak Venkatakrishnan

Reputation: 563

The following worked for me....

upload a .htaccess file to the folder where ur file exists with the following data (it should be on a new line in the htaccess file)

redirect 301 /some_dir/oldpage.htm http://www.newdomain.com/newpage.htm

and from what i read somewhere when you need to do the same for a dynamic page you can use the following

consider the page as

http://www.example.com/page.php?id=13

the redirect would be

RewriteEngine on 
RewriteCond %{QUERY_STRING} ^id=13$
RewriteRule ^/page.php$ http://www.example.com/newname.htm? [L,R=301]

here is what i got on googling for this http://www.tamingthebeast.net/articles3/spiders-301-redirect.htm

Upvotes: 1

Related Questions