Forum Moderators: phranque

Message Too Old, No Replies

.htaccess

Dynamic url to rewrite another dynamic url

         

siacoder

6:25 pm on Jul 21, 2008 (gmt 0)

10+ Year Member



Hi,

I'm trying the line below and it doesn't do anything. It still loads up the domainname.com/news.php?n_id=15$ instead of the [domainname.com...]

Is it even possible to use the RewriteRule as so?

Appreciate any help...

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^news.php?n_id=15$ [domainname.com...] [R=301,NC]

jdMorgan

6:40 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You must use a RewriteCond directive to test %{QUERY_STRING} -- RewriteRule cannot 'see' query strings appended to the local URL-path.

Furthermore, if you wish to remove the requested query string from the new URL, you must end your substitution URL with the "?" token.

See the Apache mod_rewrite documentation for details on both points.

Jim