hi I wanted to do url rewrite on my website I want to change the following url www.test.com/video/play.php?name=file1&ext=mp4 into www.test.com/video/file1.mp4 Can you tell me what code should i enter in .htaccess thanks in advance
I think you need something like: RewriteCond %{REQUEST_URI} ^/video/play.php$ RewriteCond %{QUERY_STRING} ^name=(\w+)&ext=(\w+)$ RewriteRule ^/video http://www.test.com/video/%1\.%2? [R=301,L] Code (markup): (set to do a 301 redirect). But I'm not an .htaccess expert and so you'll probably have to experiment with that code to get just what you want.
Check this one, please RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^video/(\w+).(mp4|flv|mpeg|whatever_extension)$ video/play.php?name=$1&ext=$2 [QSA,L] Code (markup):
Thanks Rainborick and bogi. i tried both the method but i still get 404 not found. btw i placed .htaccess inside video folder. hope its correct
Hope i am not interrupting a healthy conversation here, but i think you should put .htaccess in the root of your server.