Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    Australia
    Posts
    356
    Thanks
    143
    Thanked 0 Times in 0 Posts

    adding an exception to .htaccess for addhandler modifications

    currently .htaccess in my root reads:

    Code:
    AddHandler application/x-httpd-php .php .html .htm
    AddHandler x-httpd-php5-cgi .html

    I need to create an exception for the /stats/ directory

    the context to this problem can be found, well-articulated at:

    http://blog.ericdaugherty.com/2009/1...d-godaddy.html
    The website I am building is http://www.mathannotated.com. My questions often pertain to it. This is my site plan: http://www.mathannotated.com/images/...ctory-tree.gif
    Thank you for your help in all matters. All earnest efforts in helping me will be credited with Thanks. -ptrcao

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    .htaccess is directory context aware; can you not just create another .htaccess in your /stats/ directory that remove those handlers (RemoveHandler)?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Location
    Australia
    Posts
    356
    Thanks
    143
    Thanked 0 Times in 0 Posts

    apparently not possible?

    Quote Originally Posted by Fou-Lu View Post
    .htaccess is directory context aware; can you not just create another .htaccess in your /stats/ directory that remove those handlers (RemoveHandler)?
    hello fou-lu. apparently a violation of godaddy's policies? i spoke to a godaddy customer rep who seemed to frown on it.

    Moreover, Dougherty at http://blog.ericdaugherty.com/2009/1...d-godaddy.html seems to allude vaguely to this not being an option
    This would be a simple fix if I could edit the .htaccess file in the stats directory. I could simply override the .html handler back to the default, and avoid the PHP processing.

    is there no exception line i can add to the .htaccess file in my root?

    Edit: the problem is the directory itself is reserved by godaddy and they don't like it when you modify anything inside it.
    Last edited by ptrcao; 01-17-2011 at 06:06 PM.
    The website I am building is http://www.mathannotated.com. My questions often pertain to it. This is my site plan: http://www.mathannotated.com/images/...ctory-tree.gif
    Thank you for your help in all matters. All earnest efforts in helping me will be credited with Thanks. -ptrcao

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    I'm not sure if .htaccess can handle the <LocationMatch or not. If it does, you should be able to wrap the addhandler around this: <LocationMatch "(?!/stats/?)$">AddHandler stuff</LocationMatch>. It it doesn't I'm not sure there is a way to work that out.
    Make sure you have the godaddy team provide you with documentation of where it says that its against their TOS. If they cannot, I'd consider that directory free game. I assume as well that the /stats is a url of yours under /home/user/public_html/stats, and not actually a root directory of /stats which would definitely make this forbidden (and useless since it would likely not be available to you).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    Regular Coder
    Join Date
    Dec 2010
    Location
    Australia
    Posts
    356
    Thanks
    143
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    I'm not sure if .htaccess can handle the <LocationMatch or not. If it does, you should be able to wrap the addhandler around this: <LocationMatch "(?!/stats/?)$">AddHandler stuff</LocationMatch>.
    I assume this means "if the location does not correspond to /stats/ then apply the add handler, right?

    Also the stats directory is not of my own creation; it was automatically generated by GoDaddy for their statistics feature.

    I don't want the server parsing any files in this directory, because it causes problems for viewing site statistics.

    It is a folder in the root directory, created by GoDaddy. Does this answer your question of whether it is it a "root directory"?
    The website I am building is http://www.mathannotated.com. My questions often pertain to it. This is my site plan: http://www.mathannotated.com/images/...ctory-tree.gif
    Thank you for your help in all matters. All earnest efforts in helping me will be credited with Thanks. -ptrcao

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Not really no, by root directory I mean its actually under /, listed as /stats. If it is, chances are you cannot even read that directory, and if you can its likely shared by many other people.
    Did that work in the htaccess? Yes, the pattern would say if it doesn't match /stats[/] then it would add the handler. I'm not familiar enough with apache patterns to know for sure if that will work though.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    Regular Coder
    Join Date
    Dec 2010
    Location
    Australia
    Posts
    356
    Thanks
    143
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Not really no, by root directory I mean its actually under /, listed as /stats. If it is, chances are you cannot even read that directory, and if you can its likely shared by many other people.
    Did that work in the htaccess? Yes, the pattern would say if it doesn't match /stats[/] then it would add the handler. I'm not familiar enough with apache patterns to know for sure if that will work though.
    I tried:

    Code:
    <LocationMatch "(?!/stats/?)$">AddHandler application/x-httpd-php .php .html .htm</LocationMatch>
    <LocationMatch "(?!/stats/?)$">AddHandler x-httpd-php5-cgi .html</LocationMatch>
    with no luck Fou-Lu.

    Any other ideas?
    The website I am building is http://www.mathannotated.com. My questions often pertain to it. This is my site plan: http://www.mathannotated.com/images/...ctory-tree.gif
    Thank you for your help in all matters. All earnest efforts in helping me will be credited with Thanks. -ptrcao


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •