regex - Replace php extension with slash / using .htaccess -
i want rewrite php extensions .htaccess
. want replace php extension slash /
. example if have: http://example.com/about-us.php
http://example.com/about-us/
how can make modifying piece of code:
options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / # externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1 [r,l,nc] ## internally redirect /dir/foo /dir/foo.php rewritecond %{request_filename}.php -f [nc] rewriterule ^ %{request_uri}.php [l] rewriterule .*[^/]$ $0/ [l,r=301]
thanks all!!!
you can use:
options +followsymlinks -multiviews rewriteengine on rewritebase / # externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1/ [r,l] ## internally redirect /dir/foo /dir/foo.php rewritecond %{request_filename}.php -f [nc] rewriterule ^(.+?)/?$ $1.php [l]