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


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.


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

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

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.


1

you are still linking to the URL that contains /_? ... yes but whenever user tries to go to link onclick event ,in new tab he see the _/ in it Regardless of whether we implement a redirect in .htaccess to "fix" this, you do still need to physically remove the /_ part from the URLs in the HTML source that the users click on. Otherwise, they are not "hidden"...


1

RewriteRule ^/contact/?view=full$ /contact/ [R=301,L] The RewriteRule pattern matches against the URL-path only, which notably excludes the query string. So, the above directive won't match the required URL. To match the query string you need to use an additional condition and check against the QUERY_STRING server variable. Also, in .htaccess (directory ...


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