Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite 'catch all' files problem

simple RewriteRule to cover different file names

         

richiebman

2:03 pm on Aug 21, 2004 (gmt 0)

10+ Year Member



The following is in my .htaccess file and it all works well.

RewriteRule ^home_blue$ home?theme=blue
RewriteRule ^home_red$ home?theme=red
RewriteRule ^home_green$ home?theme=green
RewriteRule ^home_purple$ home?theme=pruple
RewriteRule ^home_grey$ home?theme=grey

This all works, but as I have 10 other files in my directory, I don't want to list the above everytime for a different file. Therefore I would like to know what I can put in the place of 'home' that would cover all the files in my directory. Basically I would like to have 5 lines instead of 50 in my .htaccess file.

I understand I may need a RewriteCond line in there, but really wouldn't know where to start. Help on that would be great also.

Cheers,
Richard

moltar

2:06 pm on Aug 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

RewriteRule ^home_(.*)$ home?theme=$1

richiebman

2:28 pm on Aug 21, 2004 (gmt 0)

10+ Year Member



Absolutely beautiful. Thank you.

And if you solve my other posts problem, I will sing 'Moltar' in the street.

R