1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.htaccess file question

Discussion in 'Apache' started by hunter22375, Mar 29, 2009.

  1. #1
    I want to secure a few pages on my site using my SSL certificate. I found the folder where the pages are and there is an .htaccess file in the folder (there are actually several .htaccess files throughout the program folders......is it safe to assume that each .htaccess file handles those pages within that particular folder?) The existing .htaccess file shows the following:

    <Limit GET POST HEAD>
    deny from all
    </Limit>
    PHP:
    Should I delete the above code and place in the code below that I found on the internet?

    RewriteCond %{HTTPS} !=on
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    PHP:
    I tried this in the .htaccess file I found in the root of my site which did redirect to "https://" however, when I tried clicking on a link on my home page...it just refreshed the page. Any help would be appreciated.
     
    hunter22375, Mar 29, 2009 IP
  2. Maximise

    Maximise Member

    Messages:
    121
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #2
    I'm not an expert on SSL, but maybe somebody else can help.
     
    Maximise, Mar 29, 2009 IP
  3. hunter22375

    hunter22375 Well-Known Member

    Messages:
    162
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    OK, thanks?????
     
    hunter22375, Mar 29, 2009 IP
  4. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    are you using static or dynamic urls?

    Thanks.
     
    Lpe04, Mar 29, 2009 IP
  5. hunter22375

    hunter22375 Well-Known Member

    Messages:
    162
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #5
    I'm not sure to be honest.
     
    hunter22375, Mar 29, 2009 IP
  6. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That's ok.

    A dynamic url looks like:
    http://example.com/?page=somepage
    Code (markup):
    A static url looks like:
    http://example.com/somepage.html
    Code (markup):
    Take care.
     
    Lpe04, Mar 29, 2009 IP
    hunter22375 likes this.
  7. hunter22375

    hunter22375 Well-Known Member

    Messages:
    162
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #7
    I have static url's.
     
    hunter22375, Mar 29, 2009 IP
  8. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #8
    hmmm, can you post an example of one of the links?

    Cheers,
     
    Lpe04, Mar 29, 2009 IP
  9. hunter22375

    hunter22375 Well-Known Member

    Messages:
    162
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #9
    hunter22375, Mar 29, 2009 IP
  10. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Haha, ok, well the {REQUEST_URI} can only post static URLs. So it would get the index.php part, but not the parameter (the part after the question mark), so every page would essentially be an index.php page. Does that make sense?

    Also, each htaccess file will handle the folder it is in, otherwise it will go to the next highest folder looking for an htaccess file if one exists.

    Cheers,
     
    Lpe04, Mar 29, 2009 IP
  11. hunter22375

    hunter22375 Well-Known Member

    Messages:
    162
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #11
    Ok, then what code can I use then?
     
    hunter22375, Mar 30, 2009 IP
  12. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Have you checked {QUERY_STRING} and/or [QSA] flag?

    Cheers,
     
    Lpe04, Mar 31, 2009 IP
  13. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Hunter, try this
    
    RewriteCond %{HTTPS} !=on
    RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=301,L]
    
    Code (markup):
     
    Lpe04, Apr 1, 2009 IP