wildcart subdomain

Using a single web hosting account to host multiple sites

wildcart subdomain

Postby sniperj » Tue Oct 30, 2007 8:31 am

Hello,
I have a question about .htaccess mod_rewrite:
i have a domain: Http://www.zippus.nl/
and i want that if i do this: http://dewijnkelder.zippus.nl/
that it redirects invisible(so in the adressbar stays: http://dewijnkelder.zippus.nl) to http://zippus.nl?pagina=restaurant&rest ... wijnkelder ..
I have tried many combinations, searched on google, but i can`t find anything :(
do you know the right thing??
(i`m sorry for my bad english:P)
SniperJ
sniperj
 
Posts: 6
Joined: Tue Oct 30, 2007 8:28 am

Postby richardk » Tue Oct 30, 2007 9:54 am

You need DNS for the sub domains (to get the request to your server) and the server needs to be configured to send the sub domain requests to the directory containing the .htaccess file (so mod_rewrite can run). Then you can use the following in a .htaccess file in your document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.domain\.com$ [NC]
RewriteRule ^$ /?pagina=restaurant&restaurant=%2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby sniperj » Tue Oct 30, 2007 10:05 am

but when i do that, i get a page forbidden error?
And i always stuck at this point:S
http://media.uiteteninderegio.nl
here do i have put the code in, but it doesnt work :S
and the dns is configured well, also apache :)
this is now my htaccess:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.uiteteninderegio\.nl$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.uiteteninderegio\.nl$ [NC]
RewriteRule ^$ /?pagina=restaurant&restaurant=%2 [QSA,L]
sniperj
 
Posts: 6
Joined: Tue Oct 30, 2007 8:28 am

Postby richardk » Tue Oct 30, 2007 10:42 am

What happens if you replace QSA with R?
What does your error log say the error is?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby sniperj » Tue Oct 30, 2007 11:44 am

It doesn`t matter:s it still isn`t working :(
when i use R, it takes a very long time to load, and then a white page,
in the error log i can`t find anything about it..
but when i try this:
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{http_host} .
RewriteCond %{http_host} !^www.uiteteninderegio.nl [NC]
RewriteCond %{http_host} ^([^.]+)\.uiteteninderegio.nl [NC]
RewriteRule ^(.*) http://uiteteninderegio.nl?pagina=restaurant&restaurant=%1 [L]

it works, but in the adressbar is http://uiteteninderegio.nl?pagina=resta ... wijnkelder instead of http://dewijnkelder.uiteteninderegio.nl :S
and when i do this:
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{http_host} .
RewriteCond %{http_host} !^www.uiteteninderegio.nl [NC]
RewriteCond %{http_host} ^([^.]+)\.uiteteninderegio.nl [NC]
RewriteRule ^(.*) /?pagina=restaurant&restaurant=%1 [L]

i get a internal server error:S, and still i can`t find anything in error log:S
this is really frustrating :(
sniperj
 
Posts: 6
Joined: Tue Oct 30, 2007 8:28 am

Postby richardk » Tue Oct 30, 2007 12:06 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.uiteteninderegio\.nl$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.uiteteninderegio\.nl$ [NC]
RewriteRule ^$ /?pagina=restaurant&restaurant=%2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby sniperj » Tue Oct 30, 2007 12:13 pm

again it isn`t working :(
again i get the forbidden page .....
do you think this is because of my webhosting??
sniperj
 
Posts: 6
Joined: Tue Oct 30, 2007 8:28 am

Postby richardk » Tue Oct 30, 2007 1:59 pm

If you remove the mod_rewrite do you still get a forbidden error? If you do, the sub domains are set up incorrectly.

Also, add the filename into /?pagina=, eg. /index.php?pagina=
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby sniperj » Fri Nov 02, 2007 7:52 am

you are right (A) the subdomains are not set up correctly :P
but they are now:D
next question:
i want that if people go to: http://(variable restaurant).uiteteninderegio.nl/tiprestaurant/ that they go to:
?pagina=tiprestaurant&restaurant=(variable restaurant)
is this possible??
i now have this:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.uiteteninderegio\.nl$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.uiteteninderegio\.nl$ [NC]
RewriteRule ^$ /?pagina=restaurant&restaurant=%2 [QSA,L]

thank you :)
sniperj
 
Posts: 6
Joined: Tue Oct 30, 2007 8:28 am

Postby richardk » Fri Nov 02, 2007 12:12 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.uiteteninderegio\.nl$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.uiteteninderegio\.nl$ [NC]
RewriteRule ^$ /?pagina=restaurant&restaurant=%2 [QSA,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.uiteteninderegio\.nl$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.uiteteninderegio\.nl$ [NC]
RewriteRule ^tiprestaurant/?$ /?pagina=tiprestaurant&restaurant=%2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Next

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 28 guests

cron