Redirect help

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

Redirect help

Postby bkris » Wed Sep 02, 2009 11:31 am

Hi, I need help to redirect all /tag/xxx/xxx to my homepage.

www.example.com/tag/anything
to
www.example.com

or

www.example.com/tag/anything
to
http://www.example.com/search?search_qu ... h_type=tag

thanks for your help.
bkris
 
Posts: 3
Joined: Thu Jun 18, 2009 6:56 am

Postby richardk » Wed Sep 02, 2009 1:39 pm

/tag/anything to /
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^tag(/.*)?$ / [QSA,L]


/tag/anything to /search?search_type=tag&search_query=anything
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^tag(/(.*))?$ /search?search_type=tag&search_query=$2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby bkris » Thu Sep 03, 2009 11:57 am

Thanks for your help, really appreciated.
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^tag(/(.*))?$ /search?search_type=tag&search_query=$2 [QSA,L]

redirect to homepage works, but search doesn't work.

how to show the redirect url on the browser?
it still showing www.example.com/tag/anything
to
www.example.com/search?search_type=tag& ... y=anything
bkris
 
Posts: 3
Joined: Thu Jun 18, 2009 6:56 am

Postby richardk » Thu Sep 03, 2009 5:28 pm

I'm not sure what you are asking.

Try replacing QSA with R.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 32 guests

cron