regex - .htaccess rewrite and remove .php on only a few files -


i trying rewrite .php file extensions /

and got work wit code:

rewriteengine on

# hide .php extension snippet # externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1/ [r,l]  # internally forward /dir/foo /dir/foo.php rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.+?)/?$ $1.php [l] 

however, breaks admin pages talking database example pages have code , use url break:

create-ticket.php?device=xbox+360

i need leave extension on a couple pages...

is there way can use above code on specific files , not every file ends .php?

thanks, -o

you can exclusion this:

rewriteengine on  # hide .php extension snippet # externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} !/(create-ticket|admin)\.php [nc] rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1/ [r,l]  # internally forward /dir/foo /dir/foo.php rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.+?)/?$ $1.php [l] 

Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -