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
-
301 Redirects a Year Later
I inherited the digital maintenance of a website that was relaunched a year ago. In looking at Google Analytics, organic search a year later is still down 33%. I fear they did not install 301 Redirects but can't really get a specific answer from them. Is it possible to install them a year later to help with Google indexing and get back some of the organic traffic?
Technical SEO | | stansamples0 -
Is 301 redirect replacing or adding PA on a page ?
Hello Moz community, I am re-structuring information architecture on a website. The homepage targets keyword A
Technical SEO | | Sindicic_Alexis
There is a page /page-on-B/ that targets keyword B
There is also an older page /page-on-kinda-B/ that targets a keyword which is really close to B ( i think they should have been worked on the same page...) I want to re-optimise the homepage on keyword B because i know it is worth the effort. If i re-write the homepage to talk about B and do a 301 redirect of : /page-on-B/
/page-on-kinda-B/ to the homepage is it going to add page authority to the homepage ? is it the right way to proceed ?
Thanks for your support !0 -
Crawl Diagnostic: Notices about 301 redirects
There are detected five 301 redirects on my site and I want to understand why this is happening? And is this important to fix? http://domain.cl/subfolder ---- redirects to ----> http://domain.cl/subfolder/ What does this tell me "/" I am very curious 🙂 Thanks for every answer
Technical SEO | | inlinear
Holger0 -
Need Help writing 301 redirects in .htaccess file
SEOmoz tool shows me 2 errors for duplicate content pages (www.abc.com and www.abc.com/index.html). I believe, the solution to this is writing 301 redirects I need two 301 redirects 1. abc.com to www.abc.com 2. /index.html to / (which is www.abc.com/index.html to www.abc.com) The code that I currently have is ................................................... RewriteEngine On
Technical SEO | | WebsiteEditor
RewriteCond %{HTTP_HOST} ^abc.com
RewriteRule (.*) http://www.abc.com/$1 [R=301,L] Redirect 301 http://www.abc.com/index.html http://www.abc.com ...................................................... but this does not redirect /index.html to abc.com. What is wrong here? Please help.0 -
How long will Google take to stop crawling an old URL once it has been 301 redirected
I need to do a clean-up old urls that have been redirected in sitemap and was wondering about this.
Technical SEO | | Ant-8080 -
Trailing Slashes In Url use Canonical Url or 301 Redirect?
I was thinking of using 301 redirects for trailing slahes to no trailing slashes for my urls. EG: www.url.com/page1/ 301 redirect to www.url.com/page1 Already got a redirect for non-www to www already. Just wondering in my case would it be best to continue using htacces for the trailing slash redirect or just go with Canonical URLs?
Technical SEO | | upick-1623910 -
301 redirects twice
We currently have some 301 redirects set up on our site however sometimes a page will redirect twice before reaching the final location. Is this OK from an SEO perspective to have a page redirect twice or should we concentrate on reducing it to one?
Technical SEO | | JohnHillman0