apache - How to use mod_rewrite in httpd.conf file to remove .php extensions? -


i know there countless examples online of how use mod_rewrite in .htaccess file remove .php extensions. found this:

rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php 

and worked when used in .htaccess file in root directory.

now i'm trying switch doing rewrites in httpd.conf configuration file on server instead of htaccess. copied , pasted exact code file, wrapping in <ifmodule mod_rewrite.c></ifmodule> tag (the tutorial followed said this.)

but rewrite doesn't work; when try follow links on website worked before change, apache gives me object not found error.

i know mod_rewrite working , i'm putting code in right place , everything, because have rule

rewriterule ^/echo/(.*)$ /retired/echosomething.php?string=$1 

just after other rewrite lines , line works.

what need differently make mod_rewrite work without .php extensions? why did code work in htaccess not in httpd.conf?


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -