301 Redirect Headache
-
A weird 301 redirect request for a website. I've done typical 301 redirects of files and directories. However this new site was initially located at www.randomdirectory.sitename.com and is now located at sitename.com (with no www. at the beginning) is there a way to 301 redirect this so Google knows that it has moved?
-
Answer:
This should do it - in the virtual host config (or adapted for .htaccess - I forget what if anything needs to change in that case, sorry) This will get anything that's NOT starting with sitename.com and 301 redirect it with the full path intact to sitename.com RewriteEngine On RewriteCond %{HTTP_HOST} !^sitename\.com$ [NC] RewriteRule ^(.*)$ http://sitename.com/$1 [R=301,L] if you just want www removed, but have other domains left intact (like test.sitename.com, beta.sitename.com, etc) then change the RewriteCond to: RewriteCond %{HTTP_HOST} ^www\.sitename\.com$ [NC]
matimer at Ask.Metafilter.Com Visit the source
Related Q & A:
- How to set permanent 301 redirect with htaccess?Best solution by Quora
- What triggers a headache?Best solution by Yahoo! Answers
- Can a non-profit charity based in India get 301 (c) tax exemption in the US?Best solution by Yahoo! Answers
- Is it headache to be a landlord? Any bad experience?Best solution by Yahoo! Answers
- How to redirect 301 for windows server?Best solution by Webmasters
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.