Reputation: 11
Now i want to cleanup my url with .htaccess here is my .htaccess code
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.html$ /movies.php?id=$1&m=$2 [L]
its working fine
here is movies.php
<?php
if (!isset($_GET['m'])) {
header("Location:index.php");
} else {
$m = str_replace('_',' ',$_GET['m']);
}
echo $_GET['m'];
?>
the problem is it every time redirect the page to index.php
Upvotes: 0
Views: 84
Reputation: 11
.htaccess should be
RewriteRule ^movies/([^/]+)/([^/]+)/?.html$ movies.php?m=$2&id=$1 [NC,L,QSA]
Upvotes: 1
Reputation: 74
Your code in the else part of the condition doesn't do anything except set the $m variable, but I don't see that being used somewhere else in your code. Did you maybe intend to do something like this?
<?php
if(!isset($_GET['m'])){
header("Location:index.php");
} else {
$m = str_replace('_',' ',$_GET['m']);
}
echo $m; ?>
Upvotes: 0