Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

htaccess exclude given REQUEST_URI

Discussion in 'General Discussion' started by gigamike, Sep 8, 2015.

  1. gigamike

    gigamike Active Member

    Joined:
    Jan 14, 2008
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    51
    Guys,

    Been working several hours, i have a site which has SSL and im redirecting all non http to https i.e.

    Code:
    # http to https
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*) [URL]https://%{HTTP_HOST}%{REQUEST_URI}[/URL] [R,L]
    
    But is it possible to exclude a give REQUEST_URI not to redirect via https?

    something like this
    Code:
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !/play/\d+$ [NC]
    RewriteRule ^(.*) [URL]https://%{HTTP_HOST}%{REQUEST_URI}[/URL] [R,L]
    
    it always redirecting to http://domain.com/play/123 to https://domain.com/play/123, is it possible not to redirect a given REQUEST_URI

    Thanks in advance,

    Mike
     
    #1 gigamike, Sep 8, 2015
    Last edited by a moderator: Sep 8, 2015
  2. JacobPerkins

    JacobPerkins Well-Known Member

    Joined:
    May 2, 2014
    Messages:
    619
    Likes Received:
    97
    Trophy Points:
    103
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,
    If I understand correctly, you do *NOT* want the /play/ directory to be changed / adjusted via your rewrite rules? You can simply add a .htaccess file to your /play/ directory with 'RewriteEngine Off' inside of it, and this should work.
     
    gigamike likes this.
  3. gigamike

    gigamike Active Member

    Joined:
    Jan 14, 2008
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    51
    Hi,

    thanks for the idea, that's what i did and it works.

    thanks again,

    Mike
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice