301 Redirect from Dynamic to .html. Wants to 404 orginal - .htaccess

I apologize if in the wrong place. I have someone that has done 301 redirects where dynamic pages are being redirected to show .html. (www.printe-z.com/computer-checks to www.printe-z.com/computer-checks.html) They feels they should now use a custom 404 page for the original page(s); www.printe-z.com/computer-checks. What do you think? Leave it the way it is?

301 is better for this scenario, specially for search engines: they will associate your old urls with the new ones so you'll keep your pages rank.
People accessing your old links will be benefited too since they will be automatically redirected to new urls.

If the page has moved use 301. If it is removed all together, 404.

301 tells crawlers such as googlebot that the original page is moved permanently to the target page. So keep it as it is.
For your information, most URL rewritings are done using 301 Permanent Redirects. Also sending domain.com visitors to www.domain.com is an example where 301 redirection is used.

People might have bookmarked the old urls, or there may be a link on a website to the old url. Unless you are sure this is no longer the case, which you never can, you can remove the 301. But this is in a perfect world.
If the 301's are a maintenance burden, or have some other negative side-effect and the 301 have been there for some time ( >1 year), you could just remove them. But if not just leave them be.

Related

TYPO3 10 .htaccess redirect old links to new links not working

While updating a website (completely new page tree, IDs have changed), the old links need to redirect to the new links. Domain stays the same.
This is the first thing I write in my .htaccess
RewriteEngine on
Redirect 301 /index.php?id=5 /contact
Redirect 301 /test.html /xy.html
Redirect 301 /index.php?id=6 /imprint
# and many more
test.html successfully links to xy.html (just a test, they don't even exist and correctly show the 404 page)
the index.php?id=x redirects however do not work. They actually still open whatever new page has this ID.
I don't understand why it's not working. Is TYPO3 interfering? I though I would be safe if I write it as the first thing in my .htaccess.
TYPO3 does not interfere as the rules in the .htaccess file are evaluated before.
Another option could be to use the redirect module of TYPO3 for creating the redirects. Those can then be created in the backend and maintained by editors. A small drawback is that performance is not that perfect as in .htaccess but it is much more convenient.

Setting up 301 redirects for multiple domains merging to single domain

I've got a tricky situation where four different websites are now merging into a single site. I'm trying to figure out the best way to handle 301 redirects for old URLs from these sites.
Here's an example for illustration. Say I have these four sites:
https://red.com
https://blue.com
https://green.com
https://magenta.com
And they're all now going to be living just at https://red.com.
Each of these sites had a "Team" page...
https://red.com/team/
https://blue.com/team/
etc.
Once I've pointed all the URLs to the same place, I'd like to see if someone tried to enter one of the previous URLs, and direct them to a specific new place on the site, e.g.:
URL Entered: https://blue.com/team/
301 Redirect: https://red.com/blue/team/
URL Entered: https://green.com/team/
301 Redirect: https://red.com/green/team/
etc.
Since folks may be coming from multiple different domains, I can't use standard relative 301 redirects in .htaccess for this. I'd like to just be able to point the DNS for these other domains to go straight to red.com, and then handle the 301 redirect logic there.
Any ideas on how to handle this?
You can simply use 302 temporary redirect rather than using 301 which is permanent.
** Also don't forget to clear previous 301 redirection caches on your web browser; if used.

Redirects required for pages no longer in sitemap

I have a relatively new site that has just started to pick up a bit of traction in the SERP's. My problem is that I have published it and had it indexed with PHP URL extensions, as follows:
www.example.com/page.php
www.example.com/product.php
And so on. Obviously it is a fairly easy matter of editing the .htacess file to remove these extensions. So I will end up with:
www.example.com/page
www.example.com/product
No problems there.
Because the site is still quite small, I can easily change all the links manually to drop the .php extension, and then update the sitemap. So Google, and all users, should have no way of reaching the .php pages, although of course they still exist if you were to manually type them in.
But, because Google has a 'record' of these pages existing (even though there are no direct links to reach them now), do I need to implement 301 redirects from the .php pages to the new non-php pages? I.e. will Google try to crawl those pages that are no longer in the sitemap, but once existed? In other words, since you can still reach www.example.com/page.php , even though will be no link on the site or in the sitemaps that will take you there, would I get penalised for having duplicate content - are 301 redirects basically required when doing this kind of thing, even if there are no links to the content anymore?
Thanks very much.
It is better to have 301 redirect for some time(month or two) even though you can change all your links to nonphp urls. This way any residual URLs(will always be there) that are hanging out there will be taken care and google will index nonphp urls from your 301 redirect. Once you are sure from Logs(depending on your system) that there are no more OLD urls coming in, you can remove the 301 redirects. This is little easier way of moving all your old URLs instead of abruptly throwing 404s. 301 helps to transfer SEO values of old URLs to new ones.
Another item to look out for is using rel="canonical" if you want your .php and nonphp pages to coexist. This signals that they are not duplicates.

Old pages PR to

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.
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?
How to make a redirect or something from these old links if old
pages not open to root of domain?
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.
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]

bots and 301 redirect

I have changed the structure of the URLs of my site more than 6 months ago. I detect the use of legacy URLs and redirect to the new URL with a 301 status code. I verified with flidder that the status code is correctly returned upon the request. But bots (yahoo slurps, googlebot, etc.) are still hitting the old URLs. Is there something I am missing?
No, just it takes a very, very long time for crawlers to get the message. I have bots crawling addresses that have not existed since 2005 - when folk harp on with addresses being permanent, they really are.
Additionally, depending on how your URL's are structured, you can disallow the old addresses with robots.txt
Try this and this will only redirect to the bots.
if (preg_match("#(google|slurp#inktomi|yahoo! slurp|msnbot)#si", $_SERVER['HTTP_USER_AGENT'])) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.your-main-site.com/");
exit;
}
If external sites have linked to your old pages and those links are still accessible for bots, the bots will keep coming and try to access the content.
mentioned you site address here:
http://www.your-main-site.com/
Thats we use to transfer the domain and sometime for blackhat seo.

Resources