regex - How to change url without redirection? -


i facing rewrite url issue.

current website url :

testwebsite.com/dev/films.php?id=test 

i want :

testwebsite.com/dev/test 

i tried many htaccess changes not working.

i think below must work

options +followsymlinks rewriteengine on rewriterule ^dev/([0-9]+)-([a-z]+)/ http://testwebsite.com/dev/films.php?id=$1 [nc] 

unfortunately, got 404 page not found.

when removed htaccess , tried

testwebsite.com/dev/films/test 

it working. dont have c panel access. there server side redirection?

i dont know issue? how solved

here go, set .htaccess file in /dev/ directory

<ifmodule mod_rewrite.c>   rewriteengine on   #rewritebase /dev/    rewritecond %{request_filename} !-f   rewritecond %{request_filename} !-d   rewritecond %{request_uri} !=/favicon.ico   rewritecond %{request_filename} !\.(css|js|jpeg|jpg|gif|png|bmp)$   rewriterule ^(.*)$ index.php?id=$1 [l,b,qsa] </ifmodule> 

may require uncomment of rewritebase based on server setup


Comments