skip to Main Content

I want to set a PHP value just for some URL. For example, I have many URLs and one of them is http://example.com/admin. I want to add post_max_size php_value for this URL only.

2

Answers


  1. You might be able to use an Apache expression (Apache 2.4) in .htaccess to isolate that one URL, otherwise the directive will naturally apply to this directory tree.

    Something like:

    <If "%{REQUEST_URI} == '/admin'">
        php_value post_max_size 64M
    </If>
    

    Whether you can set a php_value at all in .htaccess is dependent on PHP being installed as an Apache module.

    Login or Signup to reply.
  2. unfortunately the construct

    <If "%{REQUEST_URI} == '/admin'">
        php_value post_max_size 64M
    </If>
    

    doesn’t work, because it seems, that on “php_value” parameter parse, the REQUEST_URI variable is not initalized. I managed to get it working by comparing THE_REQUEST variable and preg matching:

    <If "'%{THE_REQUEST}' =~ m#uploadPublic.php#">
        php_value upload_max_filesize 100M
        php_value post_max_size 100M
    </If>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search