The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

htaccess exclude given REQUEST_URI

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

  1. gigamike

    gigamike Member

    Joined:
    Jan 14, 2008
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    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. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    510
    Likes Received:
    66
    Trophy Points:
    28
    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 Member

    Joined:
    Jan 14, 2008
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

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

    thanks again,

    Mike
     
Loading...

Share This Page