Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect for dynamic pages

         

Singhvineet

10:09 am on Nov 23, 2009 (gmt 0)

10+ Year Member



Using .htaccess, I want to make a 301 redirect to two form of dyanmic genereated pages:
[abc.com...]
[abc.com...]

to my website [abc.com...]

The two version are making a duplicate issue for the home page. There are about 20 pages of the two version that are in Google index and all of the 20 point to the home.

Please help

I have used this:
redirect 301 /index.php?cPath=26 [abc.com...]
redirect 301 /index.php?cPath=25 [abc.com...]
redirect 301 /index.php?cPath=24&page=2 [abc.com...]

but it is not working.

jdMorgan

2:18 pm on Nov 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to use mod_rewrite instead of mod_alias, and use a RewriteCond to test the %{QUERY_STRING} variable for those cPath values.

Jim

johnnymac11

6:27 am on Nov 24, 2009 (gmt 0)

10+ Year Member



Hi,
I am also having a similar problem with dynamic pages. in summary. our existing site is an asp site on windows hosting. We are moving it to linux hosted site using php (joomla)
I have been trying to construct 301 redirects for our indexed pages and have tried the solution offered at [webmasterworld.com...] with no success.

I am getting a 404 error on the new host when i test this solution out by going to the index.asp?pgid=7 page:

htaccess as follows:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} &?pgid=7&?
RewriteRule ^contentpage\.asp$ [d1001379.my.ozhosting.com...] [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

My questions are:
1. Do I need to have the index.asp?pgid=7 page uploaded to the new site ie do i need to upload the old site to the new hosting
2. Are there any tricks with moving from windows to linux
3. Is the htaccess code for that page totally incorrect.

Sorry to piggyback on this thread but i have tried looking through old posts and the one mentioned above is the closest

thanks in advance

john

Singhvineet

10:17 am on Nov 24, 2009 (gmt 0)

10+ Year Member



Jim could you please write the code for the redirect. I don't have that much of knowledge to write the code. Please Jim!

Hi Jim

I have added this to my .htaccess file :

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} &?cPath=?&?
RewriteRule ^index\.php$ [abc.com...] [R=301,L]

Please let me know it is correct.

jdMorgan

1:56 pm on Nov 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Replacing the three "Redirect" directives given in your first post, you could use:

Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{QUERY_STRING} &?cPath=2[56]&? [OR]
RewriteCond %{QUERY_STRING} &?cPath=24&page=2&?
RewriteRule ^index\.php$ http://www.example.com/? [R=301,L]

Jim