regex - .htaccess Remove .php keep regular indexing -


i'm using:

rewriterule ^([^\.]+)$ $1.php [nc,l] rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1 [r,l,nc] 

this makes don't have use ".php" @ end of pages. however, if don't specify index gives 404.

example:

example.com/content.php directed example.com/content

^ works well.

however, if want go directory example.com/users gives 404 error. example.com/users/index works.

i want able remove .php way doing already, still want directories work without specifying page(automatically display index.php). i'm not fluent in regex or htaccess coding have been unable tweek myself.

any appreciated. thank you!

replace code these 2 rules:

rewritecond %{the_request} \s/+(?:index)?(.*?)\.php[\s?] [nc] rewriterule ^ /%1 [r=301,l,ne]  rewritecond %{request_filename} !-d rewritecond %{document_root}/$1.php -f [nc] rewriterule ^(.+?)/?$ /$1.php [l] 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -