I am trying to rewrite the following URL
http://dramatainment.com/dramas.php?id=000020&channel=HUM%20TV
My goal is to achieve this URL
http://dramatainment.com/dramas/id/000020/channel/HUM-TV/
Here Is the code I am using in my .htaccess file which is placed in the same folder as my index.php and dramas.php
Options +FollowSymLinks
RewriteEngine on
RewriteRule dramas/(.*)/(.*)/ dramas.php?id=$1&channel=$2
RewriteRule dramas/(.*)/(.*) dramas.php?id=$1&channel=$2
I got this code from a tutorial, it worked great for them in that tutorial. It works for me in the localhost, not online. What could be the problem? Why does it not work on live website?
try to use
RewriteEngine On RewriteRule ^dramas/id/([^/]*)/channel/([^/]*)$ /dramas.php?id=$1&channel=$2 [L]
Well the <base href="">
tag i suggested is for linking css file properly.
For your url try it like this.
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/id/([\d]+)/channel/([\w-]+)$ $1.php?id=$2&channel=$3 [QSA,NC,L]