.htaccess - Apache mod_rewrite showing no effect -


i using wamp, latest version apache 2.4.9. trying beautify urls using mod_rewrite, that's preinstalled in system. uncommented # before line in httpd.conf:

#loadmodule rewrite_module modules/mod_rewrite.so 

became

loadmodule rewrite_module modules/mod_rewrite.so 

restarted server, , wrote following re-write rule in .htaccess:

rewriteengine on rewriterule ^localhost/testmod/(\w+).php$ localhost/testmod/$1 

i saved in directory named testmode. without modifications, url of file named test.php inside folder looks like: localhost/testmode/test.php , want strip out .php url.

it doesn't changed anything. url same, localhost/testmode/test.php. making mistake in regexp or else wrong?

if have .htaccess inside testmod folder these rules should work you:

rewriteengine on rewritebase /testmod/  ## externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} \s/+(.+?)\.php[\s?] [nc] rewriterule ^ /%1 [r=302,ne,l]  ## internally redirect /dir/foo /dir/foo.php rewritecond %{request_filename}.php -f rewriterule ^(.+?)/?$ $1.php [l] 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -