Forum Moderators: phranque

Message Too Old, No Replies

Simple mod rewrite question

I've renamed my website, I'd like to point the old links.

         

perfectlygrand

2:47 am on Jun 2, 2007 (gmt 0)

10+ Year Member



I've done a complete SEO overhaul of my website, but I have one problem which is bugging me.

I have old links which are no longer used which look like this...
http://www.example.com/Merchant2/merchant.mvc?page=PG/CTGY/nl
http://www.example.com/Merchant2/merchant.mvc?page=PG/CTGY/inf

But, these are now dead, replaced by better links which look like this.
http://www.example.com/example_newsletter.html
http://www.example.com/information.html

How can I make a rule so whenever the browser encounters a certain link, (a page with weird attributes like above) and just points them to a completely different link?

Thanks.

Here was my attempt, which doesn't work...
RewriteRule ^(.*)PG/CTGY/nl$ /example_newsletter.html [R=301]

[edited by: tedster at 5:25 am (utc) on June 2, 2007]
[edit reason] use example.com - it can never be owned [/edit]

jdMorgan

12:04 am on Jun 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Query string parameters are not accessible to RewriteRule. Use a RewriteCond:

RewriteCond %{QUERY_STRING} page=PG/CTGY/(nl¦inf)
RewriteRule ^merchant\.mvc$ /site-map.html [R=301,L]

Replace the broken pipe "¦" character in the RewriteCond pattern with a solid pipe character before use; Posting on this forum modifies the pipe characters.

Jim