Question

I have site that has many links to its pages. And I will completely renew site, update CMS, content and page structure. Domain remains the same.

  1. What will get users in browser if they find somewhere on the Internet old link to old sites page and follow by that link while it's already a new site and old page where link leads to doesn't exist?
  2. How to make a redirect or something from these old links if old pages not open to root of domain?
  3. What's about Google in that case how do not lost PR and redirect that PR weight of old pages to main domain?

I am kindly appreciate any relative discussion on this topic because it's really interesting from all sides.

Était-ce utile?

La solution

What will get users in browser if they find somewhere on the Internet old link to old sites page and follow by that link while it's already a new site and old page where link leads to doesn't exist?

They will get a 404 Not Found.

How to make a redirect or something from these old links if old pages not open to root of domain?

You'll need to create a 301 redirect from every old page to the equivalent new page. You can do it using mod_alias:

RedirectMatch 301 ^/old_page/(.*)$ /new_page/$1

or mod_rewrite:

RewriteRule ^old_page/(.*)$ /new_page/$1 [L,R=301]

You'll obviously need to tailor the matching expressions and targets to your specific needs. If you have a lot of individual URL's that need redirecting, you may want to look into creating a RewriteMap.

What's about Google in that case how do not lost PR and redirect that PR weight of old pages to main domain?

As long as you use 301 redirects (a permanent redirect, as opposed to 302, a temporary redirect) Google's page ranking will transfer to the new URL.


What's better to use mod_alias or mod_rewrite in this situation and why?

Either is fine, but mod_rewrite gives you a lot more options and allows for rewrite maps. But if you are doing something simple, mod_alias is fine.

Again the same with 301 and 302 what's better to use here?

You want 301 here. It means "the resource that you requested has permanently moved to HERE" as opposed to a 302 which means "the resource that you requested isn't here right now, but in the mean time, you can find it HERE". Also, Google won't transfer any page ranking to the new page if you only do a 302 redirect, since it's meant only for temporary redirects. Not when a page has permanently moved to a new URL.

And the last I just looked on the old pages they all like domain.tld/index.php?id=77 does this rule correct RewriteRule ^index.php?id=(*)$ / [L,R=301] in that case for any id number to root?

This rule will not work. You cannot match against the query string (the ?id= part) in a RewriteRule, only against the %{QUERY_STRING} var in aRewriteCond. Also(*)` is probably not what you want.

This will 301 redirect any request for /index.php?id=N where N is any number, to the document root.

RewriteCond %{QUERY_STRING} ^id=([0-9]+)
RewriteRule ^index.php$ / [L,R=301]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top