guidelines for htaccess code to transition users to new website - apache

Suppose I have an old website with 10 webpages, and I want to deprecate it and move visitors to a new website with 100 webpages.
Two of the webpages of the old website map directly to two corresponding webpages on the new website. All other pages on the old website should go to the new website's home page. How to set that up?
I know I can use .htaccess in the public_html folder of the old website to create some permanent redirect rules for individual pages. So for the two pages that need to map one-to-one, I can do:
Redirect 301 /oldfile1.htm http://www.example.net/newfile1.htm
Redirect 301 /def/oldfile2.htm http://www.example.net/123/456/newfile2.htm
But what about all the other webpages on the old website? This is where my knowledge of .htaccess lacks. Does the .htaccess stop executing when it reaches one of the redirects above? If so, then perhaps I simply place the following AFTER the above code to catch the remaining pages?
Redirect 301 / http://www.example.net/
Or, something else? Also, will the redirect directly above map all webpages it sees to the home page of the new website (I assume so), or a matching directory/webpage page on the new website? -- That is, I don't want the situation where http://www.olddomain.com/abc/Oldfile1234.html takes users to http://www.example.net/abc/Oldfile1234.html on the new website (rather, it should take users to http://www.example.net) since most webpages do not map one-to-one.
Lastly, in the .htaccess file on the old website public_html directory, how to account for users coming from https versus http, and www versus non-www URLs?
I'm hoping there's common strategy people use for this sort of thing, since it should be fairly common, so I don't have to re-invent one.

You should be using RedirectMatch for precise matching using regular expressions. You can place these rules in root .htaccess:
RedirectMatch 301 ^/oldfile1\.htm$ http://www.example.net/newfile1.htm
RedirectMatch 301 ^/def/oldfile2\.htm$ http://www.example.net/123/456/newfile2.htm
RedirectMatch 301 ^ http://www.example.net/

Related

301 rdirect for custom URL

I have a custom made image gallery site that I converted to WordPress, this site have few thousands link like this
http://www.example.net/Gallery?cmd=viewCarGallery&carID=13&pgID=1
http://www.example.net/Gallery?cmd=viewCarGallery&carID=9&pgID=1
All link is now converted to wordpress and now I am facing problem redirect them, I tried to using like this
Redirect 301 /Gallery?cmd=viewCarGallery&carID=9&pgID=1 http://www.example.net/gallery/gallery_ID
Please help me how can I redirect this kind of URL.
A permanent 301 redirect in your .htaccess file lets search engines and others know that an old link has been replaced by a new one. It's the recommended method for directing traffic from an existing page.I added below codes in my .htaccess file.
Redirect 301 /oldfile.htm /newfile.htm
I think what you need is mod rewrite. Take a look here http://www.askapache.com/htaccess/modrewrite-tips-tricks.html
It looks like a similar question https://superuser.com/questions/155139/htaccess-301-redirect-with-regular-expressions

Redirect Rewrite for Joomla Root Domain Only?

I recently migrated an existing site between two domain names. I created 301 rewrite rules for all existing pages to their new, corresponding links and that appears to be functioning correctly.
Since I individually mapped the link rewrites I didn't have the need to apply a broad redirect all visitors. The issue I am experiencing is that I have not been able to successfully 301 redirect the root (home/index) only. I have tried redirecting / as well as /index.php, but those rules appear to interfere with my other rewrite rules. I'm guessing this has something to do with Joomla's core SEF rewrite rules, but I'm not sure.
Example:
Let's assume this is one of my redirects:
Redirect 301 /oldlink http://www.example.net/newlink
But someone somehow visits /oldlink25 (which doesn't exist and never has). The current setup where I am redirecting /index.php, which is my attempt to redirect the root only, will still redirect this visitor to the new site root. I'd prefer to 404 that visitor, and the old link, at the old domain instead.
Long story short, unless someone visits a link that has an individually declared 301 in the htaccess, how can I redirect visitors that hit the root only and not every visitor that hits any random link without a corresponding rewrite rule?

Redirecting old unused domain to new domain will help to increase Google authority?

I have been doing blogging since 5 years back and from last year i had stopped blogging and delete the domain content. (During last year all pages are removed from indexed )
now I had purchased a new domain BlogTechie and i am planning to 301 redirect that old domain to new domain.
Is It helped to gain SEO authority in Google or I should start from scratch without worrying about old domain.
I am also adding settings in webmaster tools to inform Google for the change.
SEOs attribute a large portion of most search engines' ranking algorithms to link-based factors. It's possible there may be old links to your pages out there on the internet on other websites. You can capitalize on this if you still own the old URL and boost your new domain's ranking with redirects.
If you know some of your older content's URLs, it might make sense to have a one to one redirect to the new page. If you're using apache, you can do this with an .htaccess file:
RewriteEngine On
RedirectMatch 301 /folder/oldpage.php http://www.newdomain.org/newpage.php
Anything remaining can redirect to the root.
RewriteRule ^(.*)$ http://newdomain.com/ [R=301]
Check out SEO Moz for more explanation on this: http://moz.com/learn/seo/redirection

301 Redirect using .htaccess

I had a system migration on my website and approximately 400 links got permanently changed. I'm using the following Redirect in .htaccess file for redirecting old links to new links.
Redirect 301 /old-folder/old-product.html /new-folder/new-product.html
I'm planning to do the similar thing to all 400 links.
My problem: Since I'm all having these Redirect statements in one .htaccess file, will there be any performance issues? Is it okay to add so many Redirect statements in one .htaccess file? Are there any side effects?
Note: there is no fixed pattern in the old and new links so I can't use RewriteRule.

Proper 301 redirect for sites

I have a bit of a complex question. I am moving sites from
http://www.hikingsanfrancisco.com
to
http://www.comehike.com
The directory structures will not be the same throughout both sites. What are some of the best practice things I can do in order to retain most of my existing SEO strength in both the general domain and individual pages for searches related to the other pages?
Thank you,
Alex
If most of the URLs are staying the same and just the domain is changing, you could create an .htaccess file in the root folder at the old site with the following:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.comehike.com/$1 [R=301,L]
This will make hikingsanfrancisco.com/some-page go to comehike.com/some-page.
Otherwise in that same htaccess file you could add a line for each redirect. So if hikingsanfrancisco.com/big-hikes is now going to comehike.com/even-bigger-hikes the redirect would look like:
Redirect 301 /big-hikes http://www.comehike.com/even-bigger-hikes
That 301 tells Google to now consider the new URL correct.
To redirect the whole site no matter what to the new URL you could use this:
Redirect 301 / http://www.comehike.com/
A 301 Redirect, page by page, is the best option (If you can use regular expressions is easier). Redirect the old page to a page in the new site with similar content.
Use the change of address tool in Google Webmasters tools.
Try to contact some of yours referrals to change the links that target your site.