A 301 Redirect Guide for the Clueless!

Whether you want to delete or consolidate web pages, it's always best to pass all of their search engine merit over to another existing page, to salvage visits, page rank and old backlinks. This is what a 301 redirect will do for you!

Here, you'll find copy-and-paste examples that you can use to do all sorts of things with Apache 301-redirects, from redirecting single pages to entire categories or even entire websites.

What Is A 301 Redirect?

301 redirects are commands that point search engines and visitors from an old area of a website to another area of the site; or, they can point the entire website and domain name to another website and domain name, entirely.

Where Do I Input 301 Redirects?

301 redirects go in your site's ".htaccess" file. The .htaccess is an extension-less file that sits in your root directory (/public_html), and is always accessed before your website loads, with ultimate precedence. That means that any commands in your .htaccess file will trigger before your site pops up when a search engine or a person visits it. You can edit your existing .htaccess by simply using a text editor like Notepad. Sometimes, websites don't seem to have an .htaccess file at all. All you have to do is open a text editor (such as Notepad) and save a blank page as ".htaccess", with the period before it, and no extension. Drop that in your root directory -- now, you have an .htaccess file. Then, you can add your 301 statements to it.

What's the Purpose Of A 301 Redirect?

A 301 redirect is the only way to tell search engines, as quickly as possible, that content has moved; either somewhere else within the site, or to an entirely different domain name. This helps your old website sections or old website to get "updated" in search results pages in order to display their new location. The time it takes for a 301 redirect to work is immediate, but the time it takes for entries to get updated in search results is entirely at the discretion of a search engine. It usually happens faster for sites that get indexed often.

CAUTION!

301 redirects are serious business. The instant you make a change to one, it may actually get indexed by search engines immediately; so, you really want to make sure you've gotten everything done correctly before testing it out. I recommend you take the following precautions before trying them out:

  • Backup your old .htaccess file before over-writing it with your new one that contains your 301 redirects. I can't stress this enough. If you are using an existing .htaccess file, it most likely has a bunch of stuff already in it. If you delete it and lose it forever, you might be in serious trouble.
  • Test your new 301 redirects after midnight or whenever your site is getting little activity. I typically do it at around 2:00 AM EST on a weekday. Note that all current visitors will either be bounced to the new locations being dictated by the 301 (if it works), or they'll see a big fat "500 error" (if you screwed up), which will confuse them.
  • Be ready to swap back in your old, working .htaccess file if your new version with the 301 redirects fails and gives you a 500 error. You definitely do not want to get indexed or visited with a site-wide error like that. Have patience and know that it might take you a couple days, in some cases, to get the entire thing working -- especially if you are redirecting hundreds of pages and categories the hard way.
  • Test out your 301 redirects on a staging account if you have the means to do so. In other words, create a dummy account on your server, copy over a mirror image of your website to it (blocking all search engines via robots.txt), and try out your new .htaccess on that dummy account. You can play around all you want without worrying about your existing site getting issues.
  • Test both individual redirects and category redirects to make sure everything is working properly, by simply visiting the old URLs to see that they're pointing to the proper area on the new site. While you probably don't have to test hundreds of redirects manually (if you actually have to do that many), still, test out a good dozen random ones to make sure everything is in order.

301 Redirect Scenarios

The 301 redirects being reviewed in this tutorial are strictly for .htaccess file redirects and the Apache web server with the function mod rewrite turned on (this is on by default). In each example, you'll see a shaded gray line with a command in it. Simply copy that command and paste it into your htaccess file, under the line "RewriteEngine on" (this is mandatory). If "RewriteEngine on" isn't in your htaccess file, simply type it in yourself.

Single Page Redirect

Old Page to New Page

Here's the most simple scenario: 301 redirecting an old page to an existing page. In this case, we'll redirect "www.old-site.com/old.html" to "www.new-site.com/new.html":

Redirect 301 /old.html http://www.new-site.com/new.html

The first URL is the one being directed, and the second URL is the one it is being redirected to. Did you notice that the first part only requires you to type out the page, while the second link has the entire URL? This is the proper syntax, and it must be typed this way.

Old Extension-less Page to New Extension-less Page

This also works for redirecting pages that have no extension, such as the kinds of pages that are typical of a content management system like Joomla or Wordpress. Using the above example, let's assume we need to 301-redirect pages that have no ".html" extension:

Redirect 301 /old http://www.new-site.com/new

Note that there is no "/" after the page name in that re-direct...we'll learn why, later!

Old Home Page Only to New Home Page Only

Redirecting the home page of an old website/domain name to that of a new website/domain name requires a different method, and there's only one way to do it. Use the following line, but note that it will not redirect anything else but the home page:

RedirectMatch ^/$ http://www.new-site.com

Non-www to www

Every single website you create should use this particular one! Here, we'll re-direct the non-www version of your website (such as new-site.com) to the www version of your website (such as www.new-site.com).

Options +FollowSymlinks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^new-site.com [NC]

RewriteRule ^(.*)$ http://www.new-site.com/$1 [R=301,L]

In doing so, you're eliminating search engine issues that arise from having "two versions" of a website, which also taint analytics results. Above, the code is telling the server that the domain is "[NC]" for "not case-sensitive," so that any variation of your domain will still translate over with the redirect. The "$1" after the domain means that any page or category added after it, with or without the "www.", will redirect properly.

Rename A Folder

Rename An Existing Category

Let's say you regretted naming a folder (aka, category) on your website, and wanted to change it. For example, you don't like "new-site.com/newcars/" and you wish had named it "new-site.com/cars/," because it's shorter and simpler. However, you want all of the pages in that folder to still work so that they also adapt to the new "/cars/" folder. This is what you'd use:

redirect 301 /newcars/ http://www.new-site.com/cars/

Rename an Existing Category to Deeper Category

You can perform this redirect for deeper level folders, too. So, say you want the folder "new-site.com/cars/classic/" to move over to "/cars/all/classic/." You'd use this:

redirect 301 /cars/classic/ http://www.new-site.com/cars/all/classic/

Unlike previous examples in this tutorial which involved redirecting from one page to another, please note that you'll have to leave the "/" after folder names in a folder-to-folder redirect. That's because the trailing forwardslash denotes a "folder."

For example, this is a page: "new-site.com/test" and this is a folder: "new-site.com/test/"

Move A Folder

Move Category to a Single Web Page

Unlike the previous lesson, let's say that I have a folder on my site: "new-site.com/cars/," and I'm getting rid of that entire folder and all of the pages within it, such as "/cars/ford.html," "/cars/toyota.html," "/cars/acura.html" and several dozen others. Since I'm no longer using those webpages, I'll want that entire folder and its contents to move to "new-site.com/new-page"

RedirectMatch 301 ^/cars/(.*)$ http://www.new-site.com/new-page

Move Category to a Single Web Page (with extension)

The redirect would be exactly the same as the example above, except you'd simply type the page extension at the end of it. This is mostly for anyone not using a CMS like Wordpress, where the pages all have extensions, like ".html" or ".php":

RedirectMatch 301 ^/cars/(.*)$ http://www.new-site.com/new-page.html

Domain to Domain

Sometimes, a website needs to be moved over to a new domain name for whatever reason. It's a very simple thing to do, thankfully! Just copy and paste the code below (and absolutely nothing else), and make it be the sole contents of your htaccess file:

Options +FollowSymLinks

RewriteEngine on

RewriteRule (.*) http://www.new-site.com/$1 [R=301,L]

There are two important things to note about this. For starters, this is somewhat of a "lazy" way to move a website. You're not moving the individual folders or pages over to their new counterparts on a new website; instead, you're just moving everything over to the home page of the new site. The alternative is to write a 301 redirect command for every single folder or page, if you really need to retain each page's search engine ranking.

Secondly, when you 301 redirect an old domain to a new one, be aware that you'll have to keep paying for the annual domain renewal and server account of the old domain name. Make it a point to change all of the backlinks that were pointing to the old domain, so that they point over to the new one. Once all backlinks are changed, you can consider dropping the old domain (unless it's a good domain that gets decent type-in traffic).

Example .htaccess With 301 Redirects

After all of these tutorials, you might be really confused as to how this actually looks in a final .htaccess file. Here's an example of how your .htaccess would/should look for a few different scenarios:

Example .htaccess: Old Site/Domain to New Site/Domain (Easy but Sloppy)

Options +FollowSymlinks

RewriteEngine on

RewriteRule (.*) http://www.new-site.com/$1 [R=301,L]

Above: This is the .htaccess file for the old site. It's the lazy man's way of doing an old site to new site redirect, and it's not really recommended, unless your old site is really tiny, gets no visitors and has no real keyword rankings in search engines. We're just piling up the entire old site and dumping it on to the home page of the new website, called "www.new-site.com," in this example.

Example .htaccess: Old Site/Domain to New Site/Domain (Strategic)

Options +FollowSymlinks

RewriteEngine on

RedirectMatch ^/$ http://www.new-site.com

Redirect 301 /old-category/old-page-1 http://www.new-site.com/new-page

Redirect 301 /old-category/old-page-2 http://www.new-site.com/new-page

Redirect 301 /old-category/old-page-3 http://www.new-site.com/new-page

Redirect 301 /old-category/old-page-4 http://www.new-site.com/new-page

Redirect 301 /old-category/old-page-5 http://www.new-site.com/new-page

RedirectMatch 301 ^/old-category-2/(.*)$ http://www.new-site.com/widgets/blue

RedirectMatch 301 ^/old-category-3/(.*)$ http://www.new-site.com/widgets/blue

Above: This is the .htaccess file for the old site. Here's a more strategic approach. We're moving over an old website piece-by-piece to a new one, called "www.new-site.com". It starts off by first moving over the home page, with the line that says "RedirectMatch ^/$". The next 5 lines are moving over single pages from the old site over to a page on the new site called "new-page." Obviously, those old pages (old-page-1, old-page-2, etc) are being treated as obsolete, and we're just telling search engines to point any references of them over to "/new-page". Lastly, the two "RedirectMatch" lines are moving over two entire categories and all of their pages over to a new page on the new website called "blue."

Additional 301 Info

301 Redirect Statements

  • Options +FollowSymLinks: You might see this in your existing htaccess file, before "RewriteEngine on". It's a statement that enables your "Mod Rewrite" function.
  • [NC]: The statement [NC] can be used within a 301 redirect rewrite rule. It simply tells your server that the value before it is not case sensitive, and ignores differences between capitalized and non-capitalized letters.
  • [L]: This statement, when used at the end of a rewrite rule, tells the server that it is the "last line" in the set. Anything that comes afterward will not be processed as a "set." In other words, the line under it won't be read as a "part 2" of the line above it.
  • "Redirect 301" vs "RedirectPermanent": In case you saw this in another tutorial and it's driving you crazy, note that these two statements, which appear at the start of a single-page redirect, are synonyms. Both will perform the same action.

"500 Error"

If you're getting a "500 Error" after testing out your site, be sure to swap back in your old .htaccess file immediately. Then, open the errant one and take a look at everything.

If you missed just one single character on just one line, such as a missing ^ or $ or /, the entire thing won't work! Find where you've made this error, correct it, and try again.

If you can't seem to fix the issue, start deleting lines one by one, and re-testing the file. Usually, it is a case where your "single page to single page" redirects are working fine, but you have a syntax error on one of your "category to single page" redirects. So, delete all of the "category to single page" ones, and re-try the .htaccess file again.

More 301 Redirect Tips, Tricks and Info

  • 301 redirects are always instant, because the .htaccess file is read before a page loads. In other words, there's no "wait time." If it doesn't work right away, then it's not working, period.
  • Never forget: if you're 301-redirecting an old site to a new one, you're going to pretty much have to hold on to the old site's domain name and server account forever, if it has tons of old backlinks that are impossible to manually update. It's far too risky to give up the old domain name/account if it's going to drop tons of backlinks from your portfolio, because your search rankings will sink like a rock.
  • When you've done a 301 redirect, check all pages involved: if you've redirected a main page, check both that page and several of its sub-pages to make sure they are behaving the way you've anticipated.
  • 301 redirects pass all page rank and SERPs [Search Engine Results Pages rankings] - making them a vital part of an SEO roadmap for a changing site. The passing of page rank from a 301 redirected page to another page will not be instantaneous.
  • If you made a change to your 301 statement within the .htaccess and it still doesn't work after testing it, clear your browser's cache and try again. This is a rare scenario, but something worth trying.
  • In regard to how much "credit" a 301 redirect passes from an old source to a new one, it's estimated that it will pass around 90%-95% "juice."

More by this Author


Comments & Feedback 80 comments

LisaDH profile image

LisaDH 7 years ago

Just the info I've been needing. Thanks!


CarolSue 7 years ago

a great lens with useful information! had a problem with my redirects and he was kind enough to email me personally and help. A plus to have this type of member in our squidoo community!


logiclabz 7 years ago

Being a SEO beginner learnt

to redirect. Good and clean post

We can use the URL Redirect Checker to check any status code like 301, 404, 302 etc.


GoldLizard 7 years ago

THANKS for this thorough guide! I've bookmarked this page and I'm rating it 5 stars.


Rhinoooow 7 years ago

Very good, but you've incorrect with the warning about L. It only stops processing other rules if this one matches.

Sometimes its ESSENTIAL - e.g. a CMS system that rewrites pages but you have rule to 301 an old page to a new one - you don't want both rules running at the same time.

http://www.addedbytes.com/apache/mod_rewrite-cheat...


Pixelrage LM profile image

Pixelrage LM 7 years ago Author

[in reply to Rhinoooow] Thanks for the info! I've corrected it.


Steve-Wilson 6 years ago

Thanks for this. I came across a lot of 'geeky' sites that failed to point out the need for RewriteEngine ON, so I wasted a lot of time until I found this.


vlili 6 years ago

good post! I have tried Redirect 301 /old.html http://www.mysite.com/new.html for the homepage, for example many site has index.php and if point /index.php to sitedomain.com then it broke the page due to too many redirect.

my personal blog is vlili.com, hope to more communicate


Amarca 6 years ago

Hi, your post is very useful!

I got a question. If we want to leave a page announcing the brand (and domain) change in the old site so visitors don't get confused when getting another website with a different brand and domain instead of what they were expecting to see, how do we do the redirects? Please keep in mind the following:

- The old domain will be kept working.

- The home page in the old site ranks first in google and the a product page (within the site) ranks second.

So to make it clear, we want visitor to see a transition page (that links to the new site) when accessing the old site but want to make sure we retain the ranking and at the same time, redirect all other pages in the site.

Also, can you please confirm that transferring a domain from one registrar to another will not affect the site's ranking.

Thank you for your help.


vette09 6 years ago

You rock my world. You are the ONLY tutorial I found that included this "RewriteEngine ON" info


solutionoriented 6 years ago

Here's my issue: When we transferred all of our information over to a new web site, we went to Yahoo and Google and did a redirect from our old site to our new site and it worked well.

We then gave ownership of the old web site domain name to a new owner. That new owner immediately put up their new web page, so we lost our redirects.

The new owner of the web site only has up one page, the home page. But my problem is that we lost all of our redirects from the folders within the web site.

How can I get control of my folders when the old site is controlled by a new owner?

Thank you


Dominical 6 years ago

Excellent article and boy oh boy can I relate to it. 301s can be the biggest source for a migrane for any SEO. I had changed my Joomla CMS site completely including the URL structure. I really wasn't looking forward to writing 301s for all of the pages (1000+) so what I did (with the help of Google) is I wrote a variable 301 that covered all my pages using variables and I did this using only 3 different 301s. AND IT WORKS!

Check it out @ Costa Rica SEO


Ajeet 6 years ago

I assume that having many such lines in the .htaccess is ok, right?

Redirect 301 /old1.html http://www.mysite.com/new1.html

Redirect 301 /old2.html http://www.mysite.com/new2.html

Redirect 301 /old3.html http://www.mysite.com/new3.html

Redirect 301 /old4.html http://www.mysite.com/new4.html

...


Pixelrage LM profile image

Pixelrage LM 6 years ago Author

@Ajeet: Yes - some sites have hundreds. It's not recommended to have that many, though - keep in mind that they all have to be read before a site is loaded!


anonymous 6 years ago

Informative lens.You share a very informative lens with Best Business Directory team.


RebeccaE 5 years ago

you have just saved a more nontechie mind from complete disaster, I was thinking of doing some redirects, and this explains it a lot better to me.


anonymous 5 years ago

Nice


anonymous 5 years ago

This tutorial will be very useful for me as the time that I know that I can improve my performance in athletics just consuming Generic Viagra. Thanks for presenting this information. Viagra Online Buy Viagra


Thamisgith 5 years ago

Thank you so much for that. Saved my bacon.


KBellamy1 profile image

KBellamy1 5 years ago

Exactly the information I was looking for. Thanks!


tamalds profile image

tamalds 5 years ago

Brilliant, awesome, spectacular buddy, you just saved me! I redirect my thesis......design.net site to www.ttd.bz and also did a check on existing url's they work like magic, all of them! BIG THANK YOU!


bt55 profile image

bt55 5 years ago

Nformative.Thank you. I did not have enough information on 301 redirects. Well done,


Satty_Kassoana 5 years ago

Hi very nice tutorial. Thank you. But I have a few questions. I have a website which ranks excellent for a keyword/s. But I made that site 3 years ago with simple HTML and looks a bit outdated. So I am planning to convert that old site (all 30 pages) into a more stylish wordpress modified theme based site. I mean all the pages and navigation will be same but now they will reside in a wordpress site. ALso .HTML will be now .PHP (as it goes with wordpress).

So my questions are, if I do 301 redirect:

1. Will I be keeping all old pages as well? or they will be deleted but .httpaccess file will simple let search engines know "for this page, go here"?

2. If I keep old pages, will there be any negative impact on my page rankings because I will have duplicate content now?

3. Will my page ranking will be lost if I convert all (same) content into wordpress and redirect it?

I will be very thankful for you answer.


anonymous 5 years ago

great tutorial about 301 Redirect Tutorial. Angel Blessed:)


mknjhill 5 years ago

I got a question for you then, I have one i just can't figure out. i need /post2host/?page=tos redirected to /tos.php i stumbled on this lens by accident, and am hoping you can answer my question. Thanks.


kathleenrhodes 5 years ago

What happens to backlinks? I have a http://domainname.com that I did a 301 redirect for - to go to http://www.domainname.com. (There is also a blog on the website, domainname.com/blog.) I did the redirect on March 17th. When I checked yesterday, 3/21 I found that I had lost the ~3800 backlinks that I had. When I removed the 301 redirect, they all came back. Did I just not wait long enough for the Google PR update cycle or do you think I did something wrong?


LAworkhorse profile image

LAworkhorse 5 years ago

If I deleted a bunch of pages, too many to redirect 1 by 1, how would I redirect all the missing pages back to the home page?


301redirector 5 years ago

Thanks for the tutorial.

I'm working on an online tool that you may find interesting. It creates 301 redirects automatically for you. You don't need lists of old and new URLs. It's particularly useful if you're running a larger site (such as an online store) where creating redirects by hand would take too much time.

Check it out at: http://www.301redirector.com/


skygate 5 years ago

To achieve online marketing success, the first step is to design a website for your retail orweb design Houston, TX A website that is designed according to your offline image covers the very important basics: who you are, what you do, where you are and how to find you. With strategic planning, creative web design ideas as well as thorough market and competition research, a website can be the quickest way to attract perspective customersâ interests.


skygate 5 years ago

To achieve online marketing success, the first step is to design a website for your retail orweb design Houston, TX A website that is designed according to your offline image covers the very important basics: who you are, what you do, where you are and how to find you. With strategic planning, creative web design ideas as well as thorough market and competition research, a website can be the quickest way to attract perspective customersâ interests.


skygate 5 years ago

To achieve online marketing success, the first step is to design a website for your retail orweb design Houston, TX A website that is designed according to your offline image covers the very important basics: who you are, what you do, where you are and how to find you. With strategic planning, creative web design ideas as well as thorough market and competition research, a website can be the quickest way to attract perspective customersâ interests.


hniizato 5 years ago

It worked! Thanks so much.


ElizabethLombardi 5 years ago

I have a website www.fishchumpro.com that is having problems with Google and dropped from search results due to my mistakes. I purchased several related domains so nobody can copy my unique site, one of which is www.fishburley.com. I have 301 Redirects set in GoDaddy for these unused domains to point to The Fish Chum Pro. Am I getting penalized by Google for doing this?

I would like to add a little history, I have several sites and a Wordpress blog on my GoDaddy server. The actual websites are under a directory _sites with fishchumpro.com under _sites/fishchumpro. Could this be a problem? I also in the beginning set the unused domains in the Domain Management module to point to _sites/fishchumpro and I found out when I got dropped from Google this is not the way to forward, it looked like I had 5 websites instead of 1. So I fixed this, removed the URL's from Googles index, and put up 301 Redirects. Is this OK? I am desperately trying to fix this mess.


anonymous 5 years ago

This info is enormously useful. I have done a lot of research myself on 301 redirects but I found that all the various issues of it are combined in this single lens. Thank you for a job well done. I not only liked this lens but I also Google +1 as well.


nielpet 5 years ago

You outlined the 301 redirects quite well. You did mention that for the old pages that have no backlinks. we don't have to worry about redirecting them and just submit the new sitemap to google webmasters. I wanted to ask - what if the old pages are showing up in the "Crawler Errors" section of google webmasters. Should we worry about that or will it just go away after awhile?


gatorsquid 5 years ago

good lens!


gatorsquid 5 years ago

good lens!


ElizabethLombardi 5 years ago

@Satty_Kassoana: Hi Satty_Kassoana:

I just did exactly what you are thinking of doing, new pages, new page names, but the same domain. You have asked a perfect question for the google webmaster forum http://www.google.com/support/forum/p/Webmasters?h... These people are experts and will help you. As far as duplicate content, yes you will have it, so remove all the old pages. Google will eventually drop them from their index and you new ones will show up.

A word on WordPress. I design websites in HTML. I also had some blogs in WordPress. I struggled with WordPress for 9 months and finally dumped the software last week. WordPress is not as stable as everyone says when you have multiple blogs. If you only plan on one, go for it, but my multisite crashed often, especially when I did updates. It was very frustrating and I finally moved all the blogs to html. See my little site islandlifeflorida.com. I made the site look like a blog, it was pretty easy. I use Dreamweaver and Photoshop to make sites, much easier than WordPress.


andreloxas 5 years ago

Great lens!


TerrieSoberg LM profile image

TerrieSoberg LM 5 years ago

Thank you for this great lens - you just saved my site!


equotemd 5 years ago

Excellent lens! This is by far one of the most concise and easy to read .htaccess tutorials I have ever read.


RebelPhoenix 5 years ago

Great, all important info in one place, thanks!


upstarter lm profile image

upstarter lm 5 years ago

If I want to migrate to new domain, do I have then to 301 redirect the whole site (every link individually)?


altamiraweb 4 years ago

@upstarter lm: How can I redirect the inner pages of a domain to the homepage?

Mi site is Posicionamiento web en Google


Pixelrage LM profile image

Pixelrage LM 4 years ago Author

@upstarter lm: It depends on if you want those individual pages to maintain their SE rankings. If the pages are high up in search engines, it is worth your while to 301 redirect every page individually. Otherwise, just redirect the folders and re-submit an XML sitemap.


Pixelrage LM profile image

Pixelrage LM 4 years ago Author

@altamiraweb: Follow the "single page redirect" above, but point it to www.yoursite.com. If there are too many pages and if this would take too long, then re-direct all of the folders to www.yoursite.com.


anonymous 4 years ago

Hi, Can I redirect my existing web page with 302 to a squidoo lens with the same content?


anonymous 4 years ago

Thanks for the well presented and easy to understand information on 301 redirects. With so much conflicting and useless information on the subject, it was a delight to find your article.

It was a long haul, but i've just managed to redirect around 700 URL's, all of which are working fine.

Thanks!

Jack


anonymous 4 years ago

Thanks. It's very helpful. Can you do the 301 redirect just on your website or do you need access to the webserver? I'm trying to do it for my spirulina site.


daviddaly 4 years ago

Thanks. It's very helpful. Can you do the 301 redirect just on your website or do you need access to the webserver? I'm trying to do it for my spirulina site.


anonymous 4 years ago

Great lens! Needed a read up about 301 redirects and you have given me an insightful basics.


anonymous 4 years ago

Am having a few problems with the 301 redirects, essentially what I have done a bit of housekeeping with folders and files on my website and removed a few folders, and moved and renamed the files in that folder, example shown below:

redirect 301 /products/myproduct1.shtml http://www.mysite.com/myproduct1.html which in theory as I understand, should redirect to: http://www.mysite.com/myproduct1.html

However, what is now happening is that the redirect goes to: http://www.mysite.com/products.html/myproduct1.sht... which doesn't exist so is a 404 - please note that I also renamed the old file from .shtml to .html - it's not a typo!

Would be great if someone could point out what I'm doing wrong.


anonymous 4 years ago

@anonymous: Ah, have figured it out, the above code is correct - have just noticed I added a line above it for another redirect which was redirecting the redirect!!! Example below:

redirect 301 /products http://www.mysite.com/products.html

Hope this helps anyone else out who is having similar problems - check out any other 301 redirects you are using just in case they are causing conflicts


anonymous 4 years ago

Thanks for the info - maybe you covered this but how can I have the old site address point to a neww address. We don't need the files. All we need is to have the old domain redirect to the new domain. Old domain is hosted on site new domain is hosted offsite. Does that make sense?


anonymous 4 years ago

thanks for the help but i am having a little different problem like i want to re direct domain.com/read to domain.com/read.html pages as they are the same and Google is indexing them as different can any body suggest me something and using htaccess file very important


anonymous 4 years ago

@anonymous: Hi faheem, have you tried adding a forward slash at the end of the old URL?

domain.com/read/.


anonymous 4 years ago

Hi, Thanks for the all useful information. But i have a problem in my .htaccess file.

actually i want to remove case sensitivity from 301.

Options +FollowSymlinks

RewriteEngine on

rewritecond %{HTTP_HOST} ^narang.tv [NC]

rewriterule ^(.*)$ http://www.narang.tv/$1 [R=301,NC]

this is the text as you suggested. i had used NC/nc both type but no effect.

Can any one please suggest me ASAP.......

Thanks In advance.....


anonymous 4 years ago

Thanks for posting this it has helped me fix two versions of my home page!


anonymous 4 years ago

Hi, how do I control when they type in the old site different ways? For example... If they type oldsite.com, www.oldsite.com or http://oldsite.com I want all of these options to lead to newsite.com. Thoughts? Thanks a million.


jeffster 4 years ago

Thanks. I'm just buying a site with a PR3 and lots of PR2 inner pages and this information is just what I need.


anonymous 4 years ago

So, I want to remove a page completely from my site, should I redirect its traffic to the index page? Would that be a smart choice?


anonymous 4 years ago

hi

my current website is sitting in a directory and i have another directory created for the new webpages for the same domain.i created htaccess which has redirect 301 of old webpage to new webpage and loaded it up in the new directory

1.the old directory sturcture is completely dirfferent from the new one

2.first when i changed my root directory to the new directory it gave me an internal error 500 and when i removed the htaccess the website worked.

3.the 301 code in the new directory was Redirect 301 /old.html http://www.domainname.com/folder/page.html

4.the new directory will not have any pages of the old directory.

can someone help me where things went wrong. any suggestion is greatly appreciated


AngelaKane 4 years ago

Thank you, I was looking everywhere for simple page to page 301 redirect and your examples worked perfectly.


anonymous 4 years ago

This is ridiculous - I cannot create a Notepad file named .htaccess without it insisting on putting an extension on it.

I've tried to rename the Notepad without the extension, but no success.

Did the same in Wordpad, with the same results.

Talk about clueless - I can't seem to get to square one in this.

How in the world do I make a file named .htaccess without an extension? Can somebody help me?


anonymous 4 years ago

@AngelaKane: Angela, what's your secret? I can't seem to create the simple .htaccess page without it having an extension. Can you help me?


anonymous 4 years ago

Update: I found a site that said to create in Notepad with the .txt extension, upload to the server, and THEN rename it. Sounds logical, but the server won't let me rename. How in the heck can I make this work? It shouldn't be this difficult! Thanks in advance for any help.


anonymous 4 years ago

@anonymous: If you're using Windows 7, open the folder that has your .htaccess.txt file in it.

Click the 'Organise' button then select 'Folder and search options'.

Select the 'View' tab.

Scroll down the list and uncheck the box that says, "Hide extensions for known file types", then select ok.

You should now see .htaccess.txt

Delete the .txt = Happy Days :-)


webguru_india 4 years ago

it's an amazing guide


anonymous 4 years ago

Perfect post! Maybe you can help me out: I need to redirect (301) most pages of an old website to a new one. Not all old pages will have a new one, so I want to redirect each page manually.

The problem is, that which url/page I need to use to redirect the homepage to a new one. The homepage seems to be indexed without an additive and doesn't seem to have an index.asp, index.php, or index.html.

How can I redirect (using a htaccess file) both my homepage and other pages without overriding one and another?


anonymous 3 years ago

Hi Great Post, can anyone help me with the following I have say mysite.com/folder/filename.php but if someone inputs mysite.com/folder/filename I get a 404 so how can I check for no extension and add the .php


anonymous 3 years ago

Hi,

I really need your help regarding an issue I'm facing with .htaccess file.

I've recently moved my website from html to php. Now, I want to redirect few old html pages to new php pages. The problem is that the file names are different.

Example: How to redirect:

/Patent_Filing_Support.html#

To

/services_and_pricing.php


anonymous 3 years ago

Hi,

I really need your help regarding an issue I'm facing with .htaccess file.

I've recently moved my website from html to php. Now, I want to redirect few old html pages to new php pages. The problem is that the file names are different.

Example: How to redirect:

/Patent_Filing_Support.html#

To

/services_and_pricing.php


anonymous 3 years ago

Where are these 301 redirects supposed to be entered? (on the header of each page at the old site?)


anonymous 3 years ago

Thank you! You made htaccess and 301 redirects easy to understand.


alex wolstencro profile image

alex wolstencro 3 years ago

I got a brain buster for ya. I got an affiliate site setup with wordpress that uses a 301 redirect plugin that I use for the posts (because they are images with rollover previews) and just switched from 302 and I didn't even know the plugin was 302 and not 301 until I tested I so now I hope my SEO will be better, but my question is: Is it possible for the search function to pull data from the 301 directed url associated with of corresponding post permalink, to display the featured thumbnails in search results? would I need a spider for something like this? because I don't know how a wordpress function could go outside of wordpress itself, but maybe it's possible, otherwise my plan is to enter the keywords i see in each store manually in the post content box which would be a lot of work cause I already added 230 stores! what are your thoughts on this concept?


mariacarbonara profile image

mariacarbonara 3 years ago

Interesting that Squidoo are now testing using 301 to redirect to subdomains. Lets hope they have read this!


anonymous 3 years ago

This was very helpful and straight forward, thank you.


Usman Khan Niazi 18 months ago

Thank you so much for a comprehensive blog post on this issue.


Kim Wist profile image

Kim Wist 18 months ago from Finland

Thanks, a very useful article.

I have one question concerning my own site and 301:

I made a new website last summer and changed many page names in the process. Littele later I discovered that my rankings dropped from google's page one to page two. I didn't undrestand why, until recently when I realized to redirect all the old page names to the new ones via .htacess.

Before I did this redirecting, I was using google's webmaster tools and asked all the old pages to be removed. There was increase in not found errors and I thought that getting rid of old pages this way is the solution.

It took some time but they were successfully removed.

After this I did all the redirection in my .htaccess, only to find that now I'm sitting in the middle of google's 4:th page.

Was it a mistake to remove the pages via webmaster tools or is this normal that ranking drops this much after 301 redirects?


kary stacy stacy@campus.com 5 weeks ago

can you release your data,from the unempolyment status. thank you!!!!!!!!!!!!!!!!

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working