I have this code:
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^articles(/\w+)$ ./search_page.php?mode=full_article&id=$1
the matter is to redirect all incoming urls like:
articles/XX
into:
search_page.php?mode=full_article&id=XX
the problem is that I get the “XX” with a “\”.. that says, I get my id like this:
id=\XX
not
id=XX
why is that and how to fix it?
You match everything after
articlesso the slash is included in your id. When you usearticles/it doesn’t include the slash because you match everything after it:So your sulition matches like this:
articlesYOURID(www.youdomain.tld/articlesYOURID)Now it matches this way:
articles/YOURID(www.youdomain.tld/articles/YOURID)