4

You just need to implement your more specific redirect first, before your "generic" redirect everything else directive. For example: RewriteCond %{HTTP_HOST} example\.net$ [NC] RewriteRule ^en$ https://example.com/abc [L,R=301] RewriteCond %{HTTP_HOST} example\.net$ [NC] RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301] Aside... RewriteCond %{...


4

It is always a good idea to "test" with 302 (temporary) redirects in order to avoid the caching of erroneous redirects - as you have stated. Ordinarily "testing" is just a matter of running your own tests in development before going live. tl;dr I don't see any problem in going live with a 302 in this instance and changing to 301 later. The "only" duplicate ...


3

Google allows the robots.txt 301 redirection you're talking about: Google follows at least five redirect hops as defined by RFC 1945 for HTTP/1.0 and then stops and treats it as a 404. https://developers.google.com/search/reference/robots_txt I couldn't find any information about Bing's crawler. It's my suspicion that smaller, poorly-written, non-search-...


3

No, top-level domains (example.com) can be redirected independently with regards to their subdomains (www.example.com, notredirected.example.com). The typical setup for what you're describing is to redirect example.com and www.example.com to Domain B, but keep notredirected.example.com serving.


3

# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] RewriteCond %{REQUEST_URI} !exclude RewriteRule ^(.*) http://subdomain.example.com/$1 [L,R=301] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &...


2

Another way is to use the RedirectMatch directive. RedirectMatch temp "^/folder\ (?!\ /subfolder| /exclude-file1\.html$|\ /exclude-file2\.html$|\ /exclude-dir)(.*)$" \ "/folder/subfolder/$1" As single line RedirectMatch temp "^/folder(?!/subfolder|/exclude-file1\.html$|/exclude-file2\.html$|/exclude-dir)(.*)$" "/folder/...


2

Assuming you're using the URL Rewrite Module, you can use the following set of rewrite rules in the web.config: <system.webServer> <rewrite> <rules> <rule name="ForceToExample.com" stopProcessing="true"> <!-- Match any path --> <match url="(.*)" /> <conditions> <!-- ...


2

or the one under /public_html/tlf/ In the /tlf/.htaccess file add the following mod_rewrite directives at the top to redirect any requests to the /tlf subdirectory via the main domain to the subdomain's root directory: RewriteEngine On RewriteCond %{HTTP_HOST} ^gl\.example [NC] RewriteRule (.*) https://tlf.example/$1 [R=301,L]


2

Thanks for the responses. There was another redirect I didn't know about, for www to no www, set up in the hosting provider (OVH) control panel. And the /www redirect has stopped all of a sudden so may have been a cached redirect after all.


2

Redirect 301 /page/page-a/ /page/page-b/ [R,L] On Apache this would have resulted in a 500 Internal Server Error because the [R,L] argument is not valid on a mod_alias Redirect directive. [R,L] are RewriteRule (mod_rewrite) flags. or it displays www.example.com/page/page-b/?type=page&id=page-a This is the result of a conflict between mod_alias (...


2

You basically just need to remove the /de/.htaccess file altogether!*1 Your root .htaccess already performs the necessary redirects. (*1 Or remove all the directives and keep the ErrorDocument directive if you need a separate language-specific 404 file. But see the note below regarding the format of the ErrorDocument directive.) The RewriteRule ^index\....


2

Lets take these on one at a time. Q: What happens if an old domain redirecting to a new domain expires? A: The old domain ceases to exist at all. Q: Will it still redirect? A: No. The domain no longer exists. Q: What is the effect on search engine ranking? A: That depends. For example, if there are a number of links to the old domain, these links will ...


2

Try the following at the top of your .htaccess file: RewriteRule (.*)-2/$ /$1/ [R=301,L] Any URL that ends in -2/ is redirected to the same URL without -2. The $1 (in the substitution string) is a backreference to the captured group (the part before the -2/) in the RewriteRule pattern.


2

I personally would prefer the solution where Apache ignores /usage I think I'm missing something, but if you have access to the server config then removing the webalizer.conf file entirely from your config would seem to resolve your problem? (Providing you don't need URL access to the Webalizer stats?) Alternatively, change the URL used in the webalizer....


2

I've been apprised that the DNS entries above won't work because you can't CNAME a naked domain to a subdomain. Is that correct? Yes, as stated in comments, you can't create a CNAME record on the domain apex, ie. example.com. Trying to do so can cause problems later. You would typically do this the other way round. For example: example.com. A 14400 ...


2

There is indeed another setting that controls redirects. To make Apache look at .htaccess, it is necessary to change the AllowOverrides line in the apache .conf file for the site: <Directory /var/www/oldsite/> Options FollowSymLinks AllowOverride **None** Require all granted </Directory> You can replace None by All to enable ...


2

It is very common practice to choose a preferred URL for each page and to redirect to the preferred form. The practice is known as "URL canonoicalization". This is good practice because: The redirects help SEO. It makes the site more consistent and more crawlable. It consolidates link juice value for a page to a single URL. The redirects make ...


2

The Redirect directive is designed to preserve the rest of the path across the redirect. If you don't want this behavior, you can use RedirectMatch instead which give you a lot more control: RedirectMatch /sites/praxis.* http://example.com/_Unser_Cabinet the .* matches any URL under that path and redirects any of them to the new URL without anything ...


2

As stated by Stephen, you should rather set a 410 Gone redirection, like this: # /.htaccess: Redirect 410 /pl/index/12 Redirect 410 /pl/index/16 Redirect 410 /pl/index/18 # And so on. Or, if you can identify a pattern in the paths that have to be redirected, you can use the RedirectMatch directive, for example: # /.htaccess: # Of course, you **must** ...


2

I want to redirect all traffic reaching example.com to example.app (i.e. the .com is a pure redirect). Does that have any impact on SEO? It means that any links to the .com will pass some link juice to the .app domain, though less than if the .app domain were linked directly. I am fairly certain that there are no other SEO implications. So, fairly useless ...


2

# Redirects http to https protocol RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} Your HTTP to HTTPS redirect is in the wrong place. It needs to be at the top of your .htaccess file, immediately after the RewriteBase directive and before the www to non-www redirect. (You are also missing R and L flags to trigger a permanent ...


2

<link rel="stylesheet" href="http://www.example.com/amazon/styles-site.css" type="text/css" /> The problem will be that you are linking to an HTTP (non-encrypted) resource from an HTTPS (encrypted) page. When viewing the HTTPS page (possibly after an initial redirect) then the browser will block any requests for HTTP ...


1

Sites get rearranged all of the time, some for the better, some for the worse. Use a 301 Permanent Redirect. This way Google will understand that you want it to update it's index to use the new URLs, not the old ones. Assuming your restructuring directs users to better content, you should see better performance in the long run. In the short run, you ...


1

I'm not sure why you have two "home pages". Index.html typically is the home page for a lot of web servers (like Microsoft IIS), but you appear to be using it in addition to another page that is marked as "home". If your website is new without external backlinks to index.html, you might just delete it. However, should need both, the redirect should solve ...


1

Since it's only temporary, you should use 302 redirect instead of 301. But my advice is don't use auto-redirect, but inform the visitor in existing/old website to try a new platform with a popup every visitor visit it or something else. My worry is that all new content will be indexed against a subdomain Why are you worrying about it? I don't see any ...


1

What happens if an old domain redirecting to a new domain expires? Expirations of domain names can not be seriously discussed without knowing at least the TLD, and even better the full domain itself to know its sponsoring registrar. Registry and registrar rules and custom procedures vary by TLD. Typically, a domain expiring can exhibit the following ...


1

In this case, you should leave only the new URL in your sitemap, since as you mentioned, they are already aware of the old one. When you are changing many URLs at the same time (when migrating to a new domain, for example), then you probably want to submit two sitemaps: one with the old URLs and one with the new ones, so they can find all of them). No need ...


1

I suggest you translate on english this article i wrote, it describe the full process of successfull seo migration. https://www.410-gone.fr/seo/optimisation-on-site/migration-https-certificat-ssl/refonte-site-redirection.html


1

The only way it would hurt SEO is if the new domain had previously been registered and used in an abusive or black hat manner. Just registering a new domain, with no history, and 301 redirecting it will be fine. (But do make sure all the redirects are 301s - permanent - to ensure search engines continue to index the existing domain, and not the new one.)


1

Assuming your server is Apache, you need to add 301 redirect to your. htacces file. RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.domain.com [NC] RewriteRule ^(.*)$ http://sub.domain.com/$1 [L,R=301,NC]


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