Forum Moderators: phranque
I am having a little trouble with regexp, its never been one of my strong points:
What I need is a rewritematch that will take cms-read_article.php?articleId=34 to /articles/read.php?article_id=34
34 being different each request
RewriteMatch ^/cms-read_article\.php\?articleId=([0-9]+) /articles/read.php?article_id=$1
is what I have at the moment that isnt working too well.
Any pointers?
Jim
I would guess if you edited your initial syntax to something along the lines of the following you would get close:
RewriteCond %{QUERY_STRING} articleId=([0-9]+)
RewriteRule ^cms-read_article\.php$ /articles/read.php?article_id=%1
Justin
Added: I highly recommend some of the information in the library and charter (links at the top left of the pages) to help with your understanding of mod_rewrite. =)
If you want to do an external redirect, then a small syntax change is all that is needed:
RewriteCond %{QUERY_STRING} articleId=([0-9]+)
RewriteRule ^cms-read_article\.php$ [b]http://www.example.com[/b]/articles/read.php?article_id=%1 [b][R=301,L][/b]
Jim