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 -
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.
-
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