Forum Moderators: phranque

Message Too Old, No Replies

query string redirect in all directories

         

askeli

12:00 am on Aug 14, 2004 (gmt 0)

10+ Year Member



Hi i am trying to redirect a URL with query string but i need to do this in many directories and rather deep, is there away to change this so i dont need a .htaccess in every directory?

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=9
RewriteRule ^index\.php$ [example.com...] [R=301,L]

Many Thanks

gergoe

12:48 am on Aug 14, 2004 (gmt 0)

10+ Year Member



htaccess files are inheritable (by default), which means that if you put a htaccess file in your root, it will take effect in the deepest directory of your site as well. mod_rewrite does not make difference either, but to succeed with this you need to keep in mind that if you have the htaccess file in the root of www.domain.com, and a request is made for the www.domain.com/sub/index.html then the request uri will be sub/index.html, not only index.html.

It is not clear what do you really want to implement, but according to the note above, try this one:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=9
RewriteRule index\.php$ http://www.example.com/7? [R=301,L]

if you could explain better what do you want to achieve, then we could give you better guidelines.

askeli

8:41 am on Aug 14, 2004 (gmt 0)

10+ Year Member



Thank you very much that works great :)