• hello, I made a staging wordpress site (test environment)- https://www.staging.example.com alongside the core site -www.example.com. problem is the main site https://www.example.com is tied to SSL. Hence, I cant get to staging site. The Htaccess inside the main site is as follows. It redirects every non-www To www and then http TO https in turn. Can I just add an exception here to my staging site- https://www.staging.example.com
    (root dir: public_html/staging/). I also want to allow my own ip to this staging site so that no one else can have access.

    <IfModule mod_rewrite.c>
    #First rewrite any request to the wrong domain to use the correct one (here www.)
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    #Now, rewrite to HTTPS:
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>

    I also want to know if I need to put anything in the Htaccess of my staging site (public_html/staging/htaccess)?

  • The topic ‘Making Exception in Htaccess for staging site’ is closed to new replies.