regex - .htaccess remove .php but add a / at the end -
i have code added .htaccess file , works intended.
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]
for example have = http://www.hello.com/world.php
this code removed php , http://www.hello.com/world
i want = http://www.hello.com/world/
how add / end?
thanks in advanced. -o
you can use this:
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]
Comments
Post a Comment