Wordpress, Redirects and HTacess file
-
Converted site to wordpress and having a bit of trouble with re-directs not redirecting.
Could somebody tell me whether redirects go before the
`# BEGIN WordPress` or after the # END wordpress or immediately after this bit -
<code># BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On RewriteBase /</ifmodule></code>
section of the code within my htacess file? Just wondered if this is the cause of my problems! Cheers Ted
-
Hi Takeshi,
I only need to get 2 redirects working, so I thought a plug in was a bit overkill.
They are already present in the htaccess file from the previous site (I'm running wordpress from a sub-folder but switched everything over as per the wordpress instructions.
Got the following which doesn't seem to work (any ideas what is wrong?)
RewriteCond %{HTTP_HOST} ^example.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.co.uk$
RewriteRule ^/?$ "http://www.newsite.co.uk" [R=301,L]The above should redirect from example.co.uk OR www.example.co.uk
and the is that is giving me a few problems is
RewriteCond %{HTTP_HOST} ^newsite.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.newsite.co.uk$
RewriteRule ^oldpage.htm$ "http://www.newsite.co.uk/new-page.htm" [R=301,L]That should redirect from newsite.co.uk/oldpage.htm
All these are already existing redirects done previously through my htaccess file but not too sure if the coding is correct for a wordpress based site but the last one above does not seem to be working at all!
Any ideas would be great and a big help!
Cheers
Ted -
They would go after the #END wordpress line. You can also install the plugin called "Redirection" which will allow you to put in 301 redirects without mucking about with your .htaccess file.
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
-
Google.com country redirection
As we all know, Google redirected the user based on location automatically.
Image & Video Optimization | | Moojin
e.g., connect to www.google.com from Korea, google automatically redirected to www.google.co.kr
However, for sometimes I noticed that if I connect to www.google.com, it doesn't redirect to local google anymore. I tested by using VPN, and seems like Google no longer do location redirection. Does anyone have any idea about this?0 -
Would you recommend changing image file names retroactively?
We'll be optimizing file names moving forward, but it hasn't been done in the past. I have probably 1,500 that would need to be changed, so want to make sure it's a valuable use of time/worth the effort. 🙂 Also, has anyone used Media File Renamer for wordpress? Seems this would be a good way to rename files without needing to reupload everything. Thanks!
Image & Video Optimization | | jennafrye0 -
Redirecting photos during site redesign?
Hello, We are doing a website redesign for a long-standing client. Their new website is completely different and includes mostly new elements, My question is do we need to redirect photo URLs if they are no longer on the site, and if so where do we redirect them, the homepage? Thank you! Tyler
Image & Video Optimization | | BeyondIndigo0 -
Images in Wordpress
Wondering how best to utilize the tags for images in Wordpress. I have these fields: Title Alternate Text Caption Description Is it important that I fill all of these fields in? And for these fields - is it best to use hyphens or underscores for SEO? Thanks.
Image & Video Optimization | | bigeyecreative0 -
301 redirect .com to .co.uk to improve position in UK serps
I've set up a new campaign for a website specifically targetting a service offered in a specific UK city. It's on a .com domain, and we've managed to get a few powerful links and while its only been going for a few weeks it's starting to get decent rankings in Google.com but is nowhere to be seen in Google.co.uk. It's getting good traffic but not traffic that converts probably because it's targeted to the UK and most visitors are from the US. I've just set up Google places, changed geo targeting to the UK, I've moved over to a UK host and we're targetting UK sites for links. I think while things are still at an early stage it would be a good idea to move everything that's on the .com over to the .co.uk with a 301 redirect and send all new links over to the .co.uk. What do you guys think? Is this a good idea? Thanks
Image & Video Optimization | | sandanista0 -
301 Redirect affects Google Places Listing?
Hi, A client of ours has a Google Places Listing but over the last few days we noticed that two duplicate listings have appeared with exactly the same information as the original listing. Only difference is the domain names. I did some investigation and my client says that a company cold called them recently and sold them two domain names www.bandbinbanbury.co.uk andwww.accommodationinbanbury.co.uk and it seems these two are redirecting to the main site which sits on www.hanwellhouse.com My question is can this cause that the redirected listing now appear instead of the original google places listing? Any help will be appreciated
Image & Video Optimization | | InTouchMarketing560 -
Self Hosting Videos in Wordpress
Hi, I'm trying to figure out the best way to host my own videos on my website in addition to uploading them to YouTube. My site is Wordpress-based, and I use Pages for the main landing pages, Posts to create the different products I offer. Is there a good way to upload my videos of each product into those Posts for SEO purposes? Maybe there's a specific plugin that I should be using? Thanks in advance, Shawn
Image & Video Optimization | | darkgreenguy0 -
Google’s algorithm on file size. Use IFrame or not?
With page size being a big factor in Google’s algorithm what’s the best way to implement a flash file without jeopardizing rankings? What’s your thoughts on embedding the video in an IFrame?
Image & Video Optimization | | SEO-Team0