Help with redirect for dynamic content links

New to mod_rewrite? This is a good place to start.

Help with redirect for dynamic content links

Postby bulgin » Tue Dec 22, 2009 6:25 pm

I have the following directory structure:

directory_main_site (this contains newsletter programs, etc but NO web pages)

and beneath that is:

main_site_web_pages (this contains web pages).


Users click on a link that looks like this a lot:

http://www.mainsite.com/?p=preferences& ... 093457b884

and they land on a preferences page. That's working fine.

But I need to redirect all requests to www.mainsite.com to www.mainsite.com/main_site_web_pages

without affecting the dynamic type of link shown above. A standard redirect for www.mainsite.com to redirect to www.mainsite.com/main_site_web_pages

is causing problems with the preferences link.

Any help much appreciated.
bulgin
 
Posts: 3
Joined: Thu Nov 13, 2008 7:25 am

Re: Help with redirect for dynamic content links

Postby BMN » Wed Mar 03, 2010 7:25 am

If you have a working rule, just add a conditional to it
for example redirect, if a link doesn't contain certain string

RewriteCond %{QUERY_STRING} !^(.*)p=preferences(.*)$
RewriteRule old_link new_link
BMN
 
Posts: 39
Joined: Wed Jul 05, 2006 2:15 am


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron