two subdomains

Using a single web hosting account to host multiple sites

two subdomains

Postby ralucaoprean » Fri Mar 25, 2005 3:06 am

Hi!

I have a local domain called sds.local and I have defined two subdomains called cauta.sds.local and test.sds.local in my network by providing the ip address of the computer that has the apache server installed.
I want that when I click http://cauta.sds.local/ to be redirected to http://cauta.sds.local/sds/index.php?id=29 and when I click http://test.sds.local/ to be redirected to http://test.sds.local/sds/index.php?id=2
I've set my http.conf to load the module mode_rewrite and I've commented the 'allowoverride none'.
My htaccess looks like this:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %[HTTP_HOST] cauta.sds.local$ [NC]
RewriteRule ^/index\.php$ http://cauta.sds.local/sds/index.php?id=29 [r=301,nc]

RewriteCond %[HTTP_HOST] test.sds.local$ [NC]
RewriteRule ^/index\.php$ http://test.sds.local/sds/index.php?id=2 [r=301,nc]


It doesn't work and I don't see what I've done wrong!
ralucaoprean
 
Posts: 3
Joined: Fri Mar 25, 2005 2:55 am
Location: sibiu

Postby Caterham » Sun Mar 27, 2005 2:21 pm

I've commented the 'allowoverride none
You'll have to activate it....
At least to
Code: Select all
AllowOverride FileInfo


You have syntaxerrors in your code and your the rules will only work in per-server context since you specify a leading slash in the pattern (left part) of the rule
Code: Select all
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP_HOST} cauta\.sds\.local [NC]
RewriteRule ^index\.php$ http://cauta.sds.local/sds/index.php?id=29 [r=301,nc]

RewriteCond %{HTTP_HOST} test\.sds\.local [NC]
RewriteRule ^index\.php$ http://test.sds.local/sds/index.php?id=2 [r=301,nc]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

two subdomains

Postby ralucaoprean » Sun Mar 27, 2005 10:30 pm

I've put the 'AllowOverride FileInfo' and I've made the sintactic changes you've said.

First I got an error in htaccess that "options not allowed here" and if I comment the 'options +FollowSymLinks' in the htaccess the browser still goes to the default index.php, ignoring the rewriteengine.

What did you mean by: "your the rules will only work in per-server context since you specify a leading slash in the pattern (left part) of the rule"?
ralucaoprean
 
Posts: 3
Joined: Fri Mar 25, 2005 2:55 am
Location: sibiu

Postby Caterham » Wed Mar 30, 2005 4:00 am

ignoring the rewriteengine.
If you need to specify options +FollowSymLinks, you'd get a 403 forbiden error. You don't get one, so there is no need to add options +FollowSymLinks.
your the rules will only work in per-server context since you specify a leading slash in the pattern (left part) of the rule
You wrote ^/index\.php$ and this will only work in per-server context (in httpd.conf, but outside <Directory> or <Location>).

Be fore you try more "advanced" rules, start with simple onles like
Code: Select all
RewriteRule ^test\.html http://www.google.com [R=301,L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 108 guests

cron