-1

I'm looking for a special redirect system (htaccess) for improving SEO and the indexed structure of a website in google.

There are some Domains, who pointing to Website root directory. Therefore the Websites gets delivered by multiple Domains.

Specification for the Redirect System:

  • http -> https
  • www -> non-www
  • redirect to one host
  • only one 301 redirect (no several redirect behind each others)

Example:

Main Domain: domain-a.com

Goal: https://domain-a.com/XXX

Please look as this example Set

>>> Redirect Examples

chrix
  • 1
  • 1

2 Answers2

1

Did you try just google same answers like this or this?

Try this:

RewriteEngine On
  RewriteBase /

  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
Turar Abu
  • 368
  • 1
  • 3
  • 11
  • Hello Turar, thanks for your quick answer. But it is a standard answer everywhere to find in the Internet. 3 of the 4 wanted specifications not solved with this. Thanks anyway. – chrix Dec 12 '17 at 15:21
1
RewriteEngine on

# other domains
RewriteCond %{HTTP_HOST} !^domain-a.com [NC]
RewriteRule .* https://domain-a.com%{REQUEST_URI} [R=301,L]

# Redirect to domain with HTTPS.
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# Same for www:
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .* https://domain-a.com%{REQUEST_URI} [R=301,L]
shushu304
  • 1,506
  • 1
  • 7
  • 15