Forum Moderators: phranque
Since a few hours i've been trying to redirect an invalid query/page to a proper url. No luck at all, not that weird since i'm new to the whole .htaccess thing. Currently the url looks like this:
index.php?section=news&id=215
Instead of that url it should redirect to:
article.php?id=215
The id (215 in this case) is an articleID, so it's not static. Below is what i have so far.
RewriteCond %{QUERY_STRING} ^&id=([0-9]+)
RewriteCond %{QUERY_STRING} ^?section=news
RewriteRule ^index.php$ article.php?id=$1? [R=301,L]
RewriteCond %{QUERY_STRING} ^section=news&id=([0-9]+)
RewriteRule ^index.php$ article.php?id=%1 [R=301,L]
(This is a new approach for me - thanks for getting me to do the research :))
But definitely drop the '?' from the query_string comparision
Hopefully thats a bit closer