Page 1 of 1

Need help to rewrite a dynamic URL (.htaccess)

Posted: Thu Nov 13, 2008 7:42 am
by zurih
Hi,

I'm looking for rewrite the following:

From this:

Code: Select all

http://www.test.com/articles.php?article_category=test_category&article_name=test_name
To something like this:

Code: Select all

http://www.test.com/test_category/test_name
How can I do it?

Re: Need help to rewrite a dynamic URL (.htaccess)

Posted: Fri Nov 14, 2008 2:38 am
by GeertDD

Code: Select all

RewriteEngine On
RewriteCond %{QUERY_STRING} article_category=([a-z_]+)
RewriteCond %{QUERY_STRING} article_name=([a-z_]+)
RewriteRule /%1/%2 [R=301,L]
Not tested.
Also see: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html