Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

mod_rewrite htaccess


Mr_Cheese's Avatar
0 1

a friend at work has a problem with .htaccess and i cant seem to work it out, figured i'd pass the buck over to you guys. see if you can solve it.

1 server, 5 websites pointing towards 1 account.

the account has mod_rewrite to change urls like this: website.com/cricket/index.html into website.com/index.php?id=cricket

now thats all fairly simple, easy mod_rewrite rules.

however problem comes when with 1 htaccess file he has to do the following:

websiteone.com/swimming/index.html websitetwo.com/swim/index.html websitethree.com/backetball/index.html websitefour.com/cricket/index.html

so in the actual htaccess file there has to be seperate mod_rewrites per HTTP HOST.

i've tried adding the actual domain into the Rewrite Rule, but it isnt accepted.

suggestions?


spyware's Avatar
Banned
0 0

Create 5 different .htaccess'es?


Mr_Cheese's Avatar
0 1

in the same dir?

there can only be 1 .htaccess per directory.

[edit] ahh i see what you mean, sry i wasnt clear enough. all 5 websites point to the same hosting account and files.


spyware's Avatar
Banned
0 0

Right. Erh, use patterns? I believe there's some sort of pattern-search function in the rewrite rule. You could check for a certain name and then forward to that page, or something.


ghost's Avatar
0 0

I'm no mod_rewrite expert but looking at my cheat sheet I see you can check against various HTTP headers so if you could check for the url matching the specific regex AND HTTP_HOST.