How can I perform this 301 redirect?
-
I am working on a site for a colleague and have installed wordpress on their server in the wp directory, they want the root domain redirecting to the wp directory but everything i have tried seems to throw up errors.
i need sample.co.uk to redirect to sample.co.uk/wp/ no matter which html file they are trying to access on the root of the sample.co.uk site
help?
-
Does this work for both Linux server software and Microsoft server software? Should there already be an .htaccess file or do you usually have to upload it to the server files via FTP?
-
Also, you can install the this word press plugin http://yoast.com/wordpress/seo/.
Works very well and has an option in the plugin menu to make redirect changes to your htaccess file for redirecting pages.
The string to add in is:
redirect 301 "/page-name.html" http://wwwdomain-name.com
-
There's a great htaccess file generator at http://www.htaccessredirect.net/
-
You must have installed the wordpress on some folder rather than the root of your website.
So if you want to redirect all the traffic form “sample.co.uk” to “sample.co.uk/wp/” then use the following codes on the .htaccess file on the root (sample.co.uk/)
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteRule ^$ /wp/ [R=301]</ifmodule>OR
RewriteEngine on
RewriteRule ^([/]+)$ wp/$1 [L,R=301]OR
RedirectMatch permanent ^/$ http://sample.co.uk/wp
Although I will recommend to use the 1st one.
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
-
Proper 301 redirect code for http to https
I see lots of suggestions on the web for forwarding http to https. I've got several existing sites that want to take advantage of the SSL boost for SEO (however slight) and I don't want to lose SEO placements in the process. I can force all pages to be viewed through the SSL - that's no problem. But for SEO reasons, do I need to do a 301 redirect line of code for every page in the site to the new "https" version? Or is there a way to catch all with one line of code that Google, etc. will recognize & honor?
Technical SEO | | wcksmith10 -
.htaccess Redirect 301 issues
I have completely rewritten my web site, adding structure to the file directories. Subsequently added was Redirect information within the .htaccess file. The following example ...
Technical SEO | | Cyberace
Redirect 301 /armaflex.html http://www.just-insulation.com/002-brands/armaflex.html
Returns this response in the URL bar of ...
http://www.just-insulation.com/002-brands/armaflex.html?file=armaflex
I am at a loss to understand why the suffix "?file=armaflex" is added The following code is inserted at the top of the file ...
RewriteEngine On redirect html pages to the root domain RewriteRule ^index.html$ / [NC,R,L] Force www. prefix in URLs and redirect non-www to www RewriteCond %{http_host} ^just-insulation.com [NC]
RewriteRule ^(.*)$ http://www.just-insulation.com/ [R=301,NC] Any advice would be most welcome.0 -
301 Redirects on Large Real Estate Website
Hi guys,We are about to move over to a new website and need advice on handling the 301 redirects.We have a large real estate website with around 12,000 pages, a lot of these are properties (about 10,000)On our old website, the url structure for each property is as follows -domainname.com/property/view?property=14863on our new site, the url structure isdomainname.com/properties/view/6137The property ID number is always different from old site to new. The way we see it, we have two options. a.) a manual redirect of each and every property url. A very very long jobb.) a folder level redirect, so redirect the 'property' folder on the old site into the 'properties' folder on new. The con with this one is we are not sure if this is the best route to take, if it is how we would go about it?Some advice would be really appreciated guys. I know there are some hyper intelligent SEO's in here and we need to make sure we handle this right!Many thanks in advance.Mark
Technical SEO | | Nextman0 -
301 Redirect / cross-domain canonical to a URL w/ Ampersand
I have a question regarding ampersands, we are needing to redirect to a URL w/ an ampersand in the URL: http://local.sfgate.com/b18915250/Sam-&-Associates-Insurance-Agency Will Google pass page authority/juice despite the fact that there is an ampersand in the URL, if we were to 301 redirect or cross-domain canonical to the url? Should we 301 redirect to http://local.sfgate.com/b18915250/Sam-%26-Associates-Insurance-Agency instead of http://local.sfgate.com/b18915250/Sam-&-Associates-Insurance-Agency? I don't have the option of removing the ampersand Thank you for your time!
Technical SEO | | Gatelist0 -
Where to put 301 redirects in Magento?
I will be changing the URL structure in a magento store from "base/category/subcategory/product" to "base/product" which means i have to make over 1000 URL 301 redirects so our old links still work. Should i put the redirects in a .htaccess file so they stay intact no matter what or should i just put them in with all the other rewrites (in Magento 's URL rewrite manager)? Thanks
Technical SEO | | tilenkrivec0 -
301 redirect Issues
my clients site is www.greenbayharvest.co.uk When you enter that URL it redirects to www.greenbayharvest.co.uk/shop, dont ask why, thats the way they set it up and thats what im stuck with. So, how do i resolve the 301 issue here. we want all things to point to www.greenbayharvest.co.uk, in terms of SEO but does the fact that there is a redirect going to /shop make this an issue? we appear to have: www.greenbayharvest.co.uk/shop www.greenbayharvest.co.uk greenbayharvest.co.uk greenbayharvest.co.uk/shop all these URL's go to the same same page so what is the best way to correct this? thanks for any help on this Lee
Technical SEO | | IPIM0 -
Will 301 redirecting a site multiple times still preserve the original site value?
Hi, All! If site www.abc.com was already 301 redirected to site www.def.com, and now the site owner wants to redirect www.def.com to www.ghi.com - is there any concern that it's not going to work, and some of the original linkjuice, rank, trust, etc. is going to vanish? Or as long as the 301s are set up right, should you be able to 301 indefinitely? Does anyone have any experience with actually doing this and seeing good/bad/neutral results? Thanks in advance! -Aviva B
Technical SEO | | debi_zyx0 -
301 Redirect vs Domain Alias
We have hundreds of domains which are either alternate spelling of our primary domain or close keyword names we didn't want our competitor to get before us. The primary domain is running on a dedicated Windows server running IIS6 and set to a static IP. Since it is a static IP and not using host headers any domain pointed to the static IP will immediately show the contents of the site, however the domain will be whatever was typed. Which could be the primary domain or an alias. Two concerns. First, is it possible that Google would penalize us for the alias domains or dilute our primary domain "juice"? Second, we need to properly track traffic from the alias domains. We could make unique content for those performing well and sell or let expire those that are sending no traffic. It's not my goal to use the alias domains to artificially pump up our primary domain. We have them for spelling errors and direct traffic. What is the best practice for handling one or both of these issues?
Technical SEO | | briankb0