将Domain1重定向到HTTP非www到HTTPS www-Domain2而不使用HTTPS htaccess

凯文·G

我在Opencart有一家杂货店。Domain1使用HTTPS,domain2使用HTTP。我的.htaccess文件中有以下设置,因为我希望两个域都重定向到HTTP(S):// www。

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 



RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
#RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteEngine On
## domain1 ##
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.domain1.nl/$1 [L,R=301]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.domain1.nl/$1 [L,R=301] 

## domain2 ##



### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none

Domain1工作正常,但是当我访问domain2时,显示为domain1。

有人知道正确的.htaccess设置吗?

阿努巴瓦

您可以使用以下2条规则:

RewriteEngine On

## domain1 ##
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.nl$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.domain1.nl%{REQUEST_URI} [L,R=301,NE] 

## domain2 ##
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.nl$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
RewriteCond %{HTTPS} on
RewriteRule ^ http://www.domain2.nl%{REQUEST_URI} [L,R=301,NE]

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用htaccess将www重定向到非www

来自分类Dev

htaccess将http://和http:// www重定向到与子域配合使用的https://

来自分类Dev

使用.htaccess将http和https的所有非www都重定向到www

来自分类Dev

htaccess将https重定向到http,将.com重定向到.co.uk和http:// www。到http://

来自分类Dev

如何结合两个Apache htaccess重定向条件(http到https和非www到www)

来自分类Dev

htaccess非www到www,而http到https和http:// www到https:// www

来自分类Dev

如何使用htaccess将非www重定向到www?

来自分类Dev

将所有非www,www,http://请求重定向到https:// www。使用.htaccess文件

来自分类Dev

使用.htaccess从http重定向到https而不使用www

来自分类Dev

htaccess将域名重定向到https,将子域名重定向到http,将www重定向到非www

来自分类Dev

将带www的domain.com/folder重定向到非www,同时将http重定向到https

来自分类Dev

htaccess中的http到https以及www重定向到非www

来自分类Dev

.htaccess将https:// www强制重定向到https://无效

来自分类Dev

htaccess重定向到“ https:// www”。

来自分类Dev

如何使用htaccess将www和非www重定向到特定域的https

来自分类Dev

htaccess将域名重定向到https,将子域名重定向到https,将非www重定向到www

来自分类Dev

使用.htaccess将所有网站链接www重定向到非www并将http重定向到https

来自分类Dev

如何使用.htaccess将HTTPS非www重定向到HTTPS www?

来自分类Dev

重定向www。到非www并使用.htaccess将所有http重定向到https

来自分类Dev

在.htaccess中将http重定向到https并将www重定向到非www

来自分类Dev

301通过htaccess将index.html以及所有http,https,www和非www版本的首页URL重定向到https:// www根URL

来自分类Dev

htaccess非www到www,而http到https和http:// www到https:// www

来自分类Dev

.htaccess强制将https:// www重定向到https://无效

来自分类Dev

通过htaccess将http://重定向到https://www.www

来自分类Dev

htaccess重定向到“ https:// www”。

来自分类Dev

如何使用htaccess将www和非www重定向到特定域的https

来自分类Dev

重定向www。到非www并使用.htaccess将所有http重定向到https

来自分类Dev

htaccess将301 https www重定向到非www

来自分类Dev

.htaccess http www 或非 www 重定向到 https

Related 相关文章

  1. 1

    使用htaccess将www重定向到非www

  2. 2

    htaccess将http://和http:// www重定向到与子域配合使用的https://

  3. 3

    使用.htaccess将http和https的所有非www都重定向到www

  4. 4

    htaccess将https重定向到http,将.com重定向到.co.uk和http:// www。到http://

  5. 5

    如何结合两个Apache htaccess重定向条件(http到https和非www到www)

  6. 6

    htaccess非www到www,而http到https和http:// www到https:// www

  7. 7

    如何使用htaccess将非www重定向到www?

  8. 8

    将所有非www,www,http://请求重定向到https:// www。使用.htaccess文件

  9. 9

    使用.htaccess从http重定向到https而不使用www

  10. 10

    htaccess将域名重定向到https,将子域名重定向到http,将www重定向到非www

  11. 11

    将带www的domain.com/folder重定向到非www,同时将http重定向到https

  12. 12

    htaccess中的http到https以及www重定向到非www

  13. 13

    .htaccess将https:// www强制重定向到https://无效

  14. 14

    htaccess重定向到“ https:// www”。

  15. 15

    如何使用htaccess将www和非www重定向到特定域的https

  16. 16

    htaccess将域名重定向到https,将子域名重定向到https,将非www重定向到www

  17. 17

    使用.htaccess将所有网站链接www重定向到非www并将http重定向到https

  18. 18

    如何使用.htaccess将HTTPS非www重定向到HTTPS www?

  19. 19

    重定向www。到非www并使用.htaccess将所有http重定向到https

  20. 20

    在.htaccess中将http重定向到https并将www重定向到非www

  21. 21

    301通过htaccess将index.html以及所有http,https,www和非www版本的首页URL重定向到https:// www根URL

  22. 22

    htaccess非www到www,而http到https和http:// www到https:// www

  23. 23

    .htaccess强制将https:// www重定向到https://无效

  24. 24

    通过htaccess将http://重定向到https://www.www

  25. 25

    htaccess重定向到“ https:// www”。

  26. 26

    如何使用htaccess将www和非www重定向到特定域的https

  27. 27

    重定向www。到非www并使用.htaccess将所有http重定向到https

  28. 28

    htaccess将301 https www重定向到非www

  29. 29

    .htaccess http www 或非 www 重定向到 https

热门标签

归档