htaccess redirect 4 specific pages to https

前端 未结 2 892
礼貌的吻别
礼貌的吻别 2021-01-05 09:35

I have a problem where I need to redirect 4 specific pages on my website to their https secure versions.

I currently have an htaccess file which is redirecting both

2条回答
  •  清酒与你
    2021-01-05 10:11

    I have modified and cleaned up your code. You can use this code in your .htaccess file in $DOCUMENT_ROOT:

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    # HTTPS is not already on
    RewriteCond %{HTTPS} !=on
    # Redirect to HTTPS is URI is page1.php OR page2.php OR page3.php OR page4.php
    RewriteRule ^page[1234]\.php$ https://mydomain.com%{REQUEST_URI} [L,R]
    

提交回复
热议问题