Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite Multiple Domains on One Host

Mod_Rewrite Multiple Domains on One Host

         

defonic

3:09 am on Mar 15, 2009 (gmt 0)

10+ Year Member



First off I would like to say hello, this is my first post and have looked at different forums and decided to join here.
Secondly I am not looking for a handout just some pointers of what I am doing wrong before I have pulled all my hair out :)

Okay, I have a hosting package (shared) I host multiple domains on this one hosting package. I have my main domain pointed to my root folder and all my other domains are inside a folder called "sites" with a directory created for each domain like so:
/maindomain <- root folder where my main domain points
/maindomain/sites/wwwdomain2com <-another domain points here
/maindomain/sites/wwwdomain3com <-another domain points here
/maindomain/sites/wwwdomain4com <-another domain points here

Of course each is a different domain, these aren't sub domains. The script I run in root uses mod_rewrite and all has been well until I decided to start up another website, and the new script for the new website uses mod_rewrite also which is inside "sites/mynewebsite" problem is, I keep getting 404 errors on my new site when anything is clicked it keeps referring back to the root domain like so
Error /sites/mynewwebsite/index.php was not found. I am assuming its reading the .htaccess in the root folder but I dont understand why since I havent declared that anywhere in the script.
Heres a sample of the .htaccess in root:


Options -Indexes
RewriteEngine On
RewriteRule ^Logoff.html/?$ index.php?action=logoff
RewriteRule ^Forgot-Password.html/?$ index.php?action=forgotpw

Heres a sample of the .htaccess root/sites/mynewwebsite/:

RewriteEngine on
RewriteRule ^index.html$ index.php [L]
RewriteRule ^most-popular/?$ index.php?order=2 [L]

Can someone tell me why my new script is referring back to the root domain? Do I have to change locations in .htaccess on root? (yes base tags are set for each domain per script) Sorry for the long post just wanted to be detailed! Thanks for anyone's advice!

jdMorgan

3:12 pm on Mar 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try setting "RewriteOptions None" in your add-on site .htaccess, in case your default server config is "RewriteOptions Inherit". See the mod_rewrite RewriteOptions documentation for details.

Note also that your root .htaccess RewriteRule directives are both missing [L] flags. This is inefficient.

Jim

g1smd

6:18 pm on Mar 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteOptions None
gives me Error 500, but
RewriteEngine Off
did what I wanted to do.

defonic

6:07 pm on Mar 18, 2009 (gmt 0)

10+ Year Member



Thanks I will give it a try

g1smd

8:34 pm on Mar 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What I wanted to do, might not be exactly what you wanted to do. Check the Apache documentation for the details.