Hot answers tagged

3

On a WordPress site WordPress uses mod_rewrite to handle the URL routing (pretty URLs) - which I assume you are using - so you should avoid using a mod_alias redirect (Redirect, RedirectMatch, etc.) in this instance. (Different modules run at different times, regardless of the order of the directives in the .htaccess file, so you can get unexpected results/...


2

I think this should do the trick for you. On the old domain, put this code in the .htaccess file (this assumes a 301 redirect is used). RewriteEngine On RewriteRule (.*) https://newdomain.example [R=301,L]


2

"Cloaking" in this situation would be fine. When the user agent contains bot|crawl|slurp|spider you should not use session id parameters or check for cookies. You are delivering the same content to users and bots. Google won't have a problem with this particular cloak. I use a similar technique for deciding whether or not to use Data URI for the images ...


1

You'll need to use mod_rewrite (as opposed to a mod_alias Redirect) and check the HTTP_HOST server variable (which tells you which site has been accessed). Something like the following at the top of your .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?website1\.com$ [NC] RewriteRule ^example/(.*)$ http://www.website2.com/example/$1 [R=302,...


1

My current solution is to use the RedirectPermanent directive The RedirectPermanent (mod_alias) directive is prefix matching so, as you have found, you will be redirected to the "corresponding path" on the newdomain. However, the complementary mod_alias directive RedirectMatch matches using a regex and will allow you to redirect all URLs to the single ...



Only top voted, non community-wiki answers of a minimum length are eligible