apache - .htaccess URL re-write - strip .php suffix -


i want rewrite urls this:

http://domain.com/category.php?id=xx 

to:

http://domain.com/category/?id=xx 

also, want hide index.php. how can achieve .htaccess? following code doesn't work:

##redirects-start  ##redirects-end  rewriteengine on rewritebase / rewriterule ^index\.php$ - [l]  rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l] rewriterule ^([_0-9a-za-z-]+/)?(admin.*) $2 [l] rewriterule ^([_0-9a-za-z-]+/)?(.*\.php)$ $2 [l] ### root dir project rewriterule . wallkill/index.php [l] 

thanks.

try code

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename}.php -f rewriterule ^(.*)$ $1.php [nc,l] 

reference link


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -