New answers tagged

4

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


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


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

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


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

You can add the below code into your site's .htaccess file to fix this issue: # Redirect non-www to www: RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


-1

You could also just install the excellent WP Redirect plugin that will make for a quick fix.


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


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.


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.


1

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


0

Whether or not you use a static page or a redirect on the home page, you will want to ensure that all deeper pages get redirected appropriately: example.com/staff -> school.example.com/staff example.com/campus -> school.example.com/campus etc. If you redirect the home page, I would expect that most people would not bookmark it. If example.com redirected ...


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


0

Although matts answer gave me some direction for the "page rule" tip in cloudflare, a bunch of stuff still had to be made. I'm assuming you already have an application running in openshift: let's suppose it's subdomain is php-example.rhcloud.com, and now you want to add custom domains example.com, example.com.cc and example.com.co to redirect to the ...


0

Redirecting multiple pages to home page m.example.com - Bad Practice The above is not at all recommended because this is considered as a soft 404 by google and hence would downgrade the seo performance of the pages. As google says redicrection from Page A to Page B should be meaningful i.e. the content is same only the site structure has changed and still ...


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


0

Another problem, believe it or not, is the risk of certain links not working at all if badly implemented. I'm right now having problems with a link in a forum to Google Plus where the + sign in the path (not quarry) is replaced by %20 (a space) resulting redirection to an invalid location.


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


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


0

the "Too many redirects" issue comes from the fact that redirects are tied together. For example, http://example.com redirects to https://example.com and https://example.com redirects back to http://example.com. This process can repeat itself over and over again until the redirect count established by the server is reached, then when that is exceeded, the ...



Top 50 recent answers are included