apache - htaccess redirect hiding the php extension or pass a parameter -


i'm using main index.php file handle of requests, basic .htacess looks this one:

rewriteengine on rewritebase / rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.+)$ /index.php?page=$1 [l] 

but i've got requests (like /signin or /signout) needs handled directly .php file same name (/signin.php , /signout.php).

so .htaccess rules needs be: "if %{request_filename}.php not exists redirect /index.php?page=$1 else redirect %{request_filename}.php".

how can this?

replace code this:

rewriteengine on rewritebase /  rewritecond %{request_filename} !-d rewritecond %{request_filename}.php -f rewriterule ^ %{request_uri}.php [l,nc]  rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename}.php !-f rewriterule ^(.+)$ /index.php?page=$1 [l,qsa] 

this send /index.php not valid file or directory , doesn't have matching .php existing in filesystem.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -