.htaccess - RewriteRule clearing post data -
<directory /var/www/website/html> options +symlinksifownermatch -indexes allowoverride rewriteengine on # enforce removal of trailing slash rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301] # if user performing search rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{query_string} ^query=([^&]+) rewriterule ^(.*)$ index.php?uri=$1&query=%1 [l,b] # if user has token set rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{query_string} ^token=([^&]+) rewriterule ^(.*)$ index.php?uri=$1&token=%1 [l,b] # if not existing file/directory, redirect index.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?uri=$1 [l,b] </directory>
when posting data directory on server query_string
condition above, appears rewriterule
clearing post data.
i looking modify rewriterule
post data still accessible when these conditions stated met.
have avoid redirect when request_method
post
:
<directory /var/www/website/html> options +symlinksifownermatch -indexes allowoverride rewriteengine on # enforce removal of trailing slash except post request rewritecond %{request_method} !post rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301,ne] # skip files , directories rewrite rules below rewritecond %{request_filename} -d [or] rewritecond %{request_filename} -f rewriterule ^ - [l] # if user performing search rewritecond %{query_string} ^query= rewriterule ^(.*)$ index.php?uri=$1&query=%1 [l,b,qsa] # if user has token set rewritecond %{query_string} ^token= rewriterule ^(.*)$ index.php?uri=$1&token=%1 [l,b,qsa] # if not existing file/directory, redirect index.php rewriterule ^(.*)$ index.php?uri=$1 [l,b,qsa] </directory>
i've refactored rules avoid redundant conditions. use qsa
flags append previous query string.
Comments
Post a Comment