logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: forbid root but allow virtual host
Author
phil1234



Joined: 24 Jul 2015
Posts: 11

PostPosted: Tue 10 Nov '15 17:39    Post subject: forbid root but allow virtual host Reply with quote

hello everyone

I am renting a ovh host with apache installed on it

I wrote a rule like

RewriteRule ^/$ www.mydomain.be

but then my virtual host is not working anymore

<VirtualHost *:80>
ServerName www.mydomain.lu
DocumentRoot /var/www/mydomain/
<Directory /var/www/mydomain/>
#Order Deny,Allow
#Deny from all
Options -Indexes
</Directory>
</VirtualHost>

If I remove the rewrite rule, it works

but

if I use nsxxxxxx.ovh.net host name I end up on the defautl "installation in progress page" instead of www.mydomain.be

so the thing is I want to host both .be and .lu sites and I dont want users to end up on the defaut apache page, but instead on the .be site

can someone help me out ?

thanks
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Thu 12 Nov '15 19:09    Post subject: Reply with quote

You should add conditions based on the host name

Like

RewriteCond %{HTTP_HOST} ....
Back to top
phil1234



Joined: 24 Jul 2015
Posts: 11

PostPosted: Fri 13 Nov '15 10:34    Post subject: Reply with quote

I dont really see how forcing the hostname will do the trick
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Fri 13 Nov '15 13:04    Post subject: Reply with quote

You can also add an default vhost and do there the redirect to one of your domains.

Code:

<VirtualHost _default_:80>
....
</VirtualHost>
Back to top
phil1234



Joined: 24 Jul 2015
Posts: 11

PostPosted: Tue 17 Nov '15 9:01    Post subject: Reply with quote

nothing works

it's more a problem of domain name than rooting the default / access

<VirtualHost _default_:80>
ServerName www.domain1.be
Redirect 301 / http://www.domain1.be/
</VirtualHost>

besides, I noticed that if I do domain2.be instead of www.domain2.be, I also endup on the default installation page
Back to top


Reply to topic   Topic: forbid root but allow virtual host View previous topic :: View next topic
Post new topic   Forum Index -> Apache