301 Redirect To Corresponding Link No Matter The URL?
-
Hey guys
I have hosting on Host Gator with I believe an apache web server. I need a code to put in the HT ACCESS to redirect all WWW URL's to their corresponding http URL. I haven't been able to get a code to work.
For example, http://www.mysite.org/page1.html -> http://mysite.org/page1.html , without having to redirect hundreds of pages individually
Here is the format my server uses in the HT ACCESS file for 301 redirects.
RewriteCond %{HTTP_HOST} ^mysite.org$ [OR] RewriteCond %{HTTP_HOST} ^www.mysite.org
$RewriteRule ^Electric-Pressure-Cookers.html$ "http://mysite.org/Pressure-Cookers.html" [R=301,L]Thanks
-
Hey Andy,
Thanks a ton - now all my URL's are appearing as the http version - one problem remains, however, and that is that I can still access the WWW version. Trying to 301 all URL's to the http version but now part of the problem is fixed. Thanks a ton!
-
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC] RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
Andy
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
When domain a buys domain b (whose links direct to c), does domain a has links redirecting to domain c ?
Hi, I really need to know what happens when a company or domain (a) acquires another company with domain (b) with its links pointing to yet another location (c). Does company a then have redirects to c?
Intermediate & Advanced SEO | | Yeshourun0 -
301 redirect to search results page?
Hi - we just launched our redesigned website. On the previous site, we had multiple .html pages that contained links to supporting pdf documentation. On this new site, we no longer have those .html landing pages containing the links. The question came up, should we do a search on our site to gather a single link that contains all pdf links from the previous site, and set up a redirect? It's my understanding that you wouldn't want google to index a search results page on your website. Example: old site had the link http://www.oldsite.com/technical-documents.html new site, to see those same links would be like: http://www.newsite.com/resources/search?View+Results=&f[]=categories%3A196
Intermediate & Advanced SEO | | Jenny10 -
Changing links after 301 already in place: is it nessasary?
Hi:
Intermediate & Advanced SEO | | romanbond
I'm in the process of making sure I have a single URL that gets all link juice for every page. As the first step, I'm implementing 301 redirects. My question is: After 301 redirect is in place will it still be necessary to update links on my site(s) that point to the old URLs. For example, I just 301-redirected mysite.com/folder/index.html to mysite.com/folder/ - and it works fine, but I still have many links on the same site and other sites that link to mysite.com/folder/index.html. Is it important to change those links to mysite.com/folder/ as well or could I just leave them as they are since the 301 is taking care of the redirect anyway.. I mean, I will probably change them in time, just to keep things tidy. But if it's important I would definitely do it sooner rather than later. Thank you in advance.0 -
301 redirect changed googles cached title tags ??
Hi, This is a new one to me ?! I recently added some 301 redirects from pages that I've removed from my site. Most of them just redirect to my home page, whilst a few redirect to appropriate replacement pages. The odd thing is that when I now search my keywords googles serp shows my website with a title that was on some of the old (now removed and redirected) pages. Is this normal? If so, how should I prevent this from happening? What is going on? The only reasons I set up the redirects was to collect any link juice from the old pages and prevent 404s. Should I remove the 301s? I fetched as google and submitted - to see if that updates the tags. (not been indexed yet) Any help would be appreciated. Kind Regards Tony
Intermediate & Advanced SEO | | thephoenix250 -
Quoestion about 301 redirect
Hey, I have interesting questions regardin 301 redirect (At least I think it's Interesting:) ) So i have this websites that compares different lenders, url below 🙂 If you go to the homepage then the first thing you see is different loan amounts in 50-99 euro range. Also you can check out different loan amounts like 100-149€, 150-199€, 200-249€ and so on. For now i have used 301 redirect and Noindex and Nofollow for all the different "loan amounts" urls. Examples below etc Is it a good idea to use 301 on all such pages to point to the homepage?
Intermediate & Advanced SEO | | TauriU0 -
Redirect between domains: any real number on how much link juice is lost?
Hi, I'm thinking of rebranding my website and moving it to a new domain. Of course I would implement 301 redirects page to page from old-domain.com to new-domain.com. I wonder if you have any real figure based on your experiments on how much link juice I could lose in the process and if it will take time for Google to re-crawl correctly the new page. I could get some of the backlinks changed as well, so they would point to the new domain. Cutts says it would get changed at least the more important, but how many? which are the more important? Also, what about if I move just a part of the website that has no backlinks? Supposedly it won't have any link juice to pass through but of course all the pages will be hosted on a brand new domain that won't pass domain-power to those internal pages, so will I lose rankings for these pages? Thanks for any help, Best regards
Intermediate & Advanced SEO | | SandraMoZ0 -
301 vs Changing Link href
We have changed our company and want to 301 old domain from new domain in order to transfer the benefits of backlinks (DA: 50, 115 Linking Root Domains). I have the ability to modify around 50% of the backlinks. So my question is: Instead of redirecting all the links, should I update the 50% to link to the new domain instead of relying on redirects? Would this possibly trip an algorithmic filter and devalue these links? Or should I just do a 301 and not worry about modifying the links?
Intermediate & Advanced SEO | | Choice0 -
301 Redirect using rewrite rule in .htaccess
Hi guys, I have these types of URLs with the format below that are seen as duplicate contents http://www.mysite.com/index.php?a=11&b=15&d=3&c=1 I wanted to permanently redirect them to my homepage. I am thinking if this is possible in .htaccess using rewrite conditions? Thanks in advance...
Intermediate & Advanced SEO | | Trigun0