Forum Moderators: phranque

Message Too Old, No Replies

How do a redirect all urls with id's in them

not working where the url contain an id

         

nippi

8:01 am on Apr 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am trying to redirect everything from foot.com/store/ down to foo.com

I am using this rule

redirect 301 /store/ [foo.com...]

This works for

store/
store/-p-101.html

but not

store/-p-101.html?zenid=36c9a9b86fa118f48dae035252543c86

as the redirect goes to

[foo.com...]

Google has indexed, the zenid pages.... and some have incoming links so I need these to redirect properly.

what to do?

g1smd

8:40 am on Apr 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use RewriteRule instead of Redirect.

Having moved the site to use new URLs, you need a way to signal to searchengines to update the information about your site held in their indexes. You also need to capture and preserve any traffic following any out of date links.

In your /zencart/ folder, add this to your /zencart/.htaccess file.
This will redirect all requests for old URLs to new URLs:

RewriteEngine On

# Index Redirect for /zencart/index.php URL with no parameters
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /zencart/index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/? [R=301,L]

# Index Redirect for /zencart/(index.php)?main_page=index(&cPath=<blank>) URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /zencart/(index\.php)?\?main_page=index(&cPath=)?\ HTTP/
RewriteRule ^(index\.php)?$ http://www.example.com/? [R=301,L]

# Canonical Redirect all /zencart/<something> URL requests to root in www
RewriteRule (.*) http://www.example.com/$1 [R=301,L]



In the root folder of the new site, your .htaccess file contents should be something like:

# ErrorDocument
ErrorDocument 404 /index.php?main_page=page_not_found

RewriteEngine On

# Index Redirect for /index.php with no parameters
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/? [R=301,L]

# Index Redirect for /(index.php)?main_page=index(&cPath=<blank>) URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?main_page=index(&cPath=)?\ HTTP/
RewriteRule ^(index\.php)?$ http://www.example.com/? [R=301,L]

# Canonical Redirect non-www to www [EXCLUDE /admin and /zencart URL requests]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{REQUEST_URI} !^/(admin|zencart) [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


Make sure you register for Google WebmasterTools and you check out the 'internal links' listings. Make sure that Google updates what it shows there. It will likely take several months, so these redirects preserve your traffic rather than simply show the 404 error message to visitors.

Look also at the 'links to your site' list. Contact those other sites. Ask them to amend any links pointing to your site to no longer include the /zencart/ part and to point to the new domain.

Check that Google, Yahoo, Bing, et. al do not have URLs with session IDs indexed.

You do not want a user to arrive at your site using a session ID that had previously been used by someone else.

nippi

12:58 pm on Apr 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



some issues here

a. ok on rewrite not redirect.
b. there has been no less than 4 rules applied to this site in the past to rewrite urls. I am not wishing to try an url match from store, to root, as am already applying a reule in root. If I try and match from store to root this is going to create double 301s. I just want to redirect all from /store/ including files with id's to root.
c. many of the incoming links are from #*$!ty sites. They wont ever respond to a link request move.