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


3

In order to match the query string (ie. page_id=123 part) you need a RewriteCond directive and the QUERY_STRING server variable (from mod_rewrite). Try something like the following in the /abc/.htaccess file (ie. in the subdirectory you want to redirect from): RewriteEngine On RewriteCond %{QUERY_STRING} ^page_id=123 RewriteRule ^$ /xyz/newindividualpage/ [...


3

If you 301 redirect an URL then the search engine will merge the records on it's end. Your /latest is filed under /3.0, which is what it will index. This not only prevents /latest being a static resource request but prevents it from even appearing in search. According to best practices, duplicate content must be canonically linked. This means your latest ...


2

If you don't need to redirect mydomain.com.co/url-example to mydomain.com/url-example then some simple page rules in cloudflare for the 2 other domains to do a 301 redirect back to the main domain would do the trick. If you need to redirect with url, the ideal case would be to set up server with 3 virtual hosts with the domains. When user visits a domain to ...


2

CNAMEs are not really redirects - they're a DNS record type that allows you to easily manage multiple domains/subdomains pointing to the same IP address, without having to change every one them if the IP changes. So using a CNAME, as far as IIS is concerned, is no different to just a normal A record. What you need is an HTTP redirect. This IIS reference ...


2

I'd suggest updating the links in your website to the absolute URL and avoid redirections (unless of course you have valuable links pointing to the URL ending with the ID) This is an unnecessary redirection and should better be avoided.


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


1

I really don't know what exactly you are trying to do with this, but the method that you are using here is safe. Do not try to fool google with any snicky redirect, because they can track your activity from webmaster and the crawling. Be genuine.


1

It's fine. The 301 code is exactly appropriate for the situation you describe.


1

See the following from CloudFlare: How do I fix the infinite redirect loop error after enabling Flexible SSL with WordPress? Some users may experience redirect loops after activating CloudFlare’s free Universal Flexible SSL option. In order to fix this issue and/or get things set please follow the steps outlined below: ** WordPress Site ** 1. Install ...



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