jabberwok_e
asked on
htaccess to deny access by requested URL
I have a virtual host set up on my apache web server. This redirects to a folder as such: /var/www/html/site2 this is <ourcustomer.com>
The default Virtual host points to /var/www/html/ as the root. This is <oursite.com>
I want to stop anyone using <oursite.com> from accessing the site2 directory
This is mainly just to make sure that our other customers don't stumble across our hosted customer's site tied to our domain name.
I tried many variations of the following code with no luck, I also tried {REQUEST_URI} with no luck.
I could recreate the default virtual host into another directory, but because of many of the internal programs and scripts, this would cause a lot of extra work.
Thanks in advance for your time.
The default Virtual host points to /var/www/html/ as the root. This is <oursite.com>
I want to stop anyone using <oursite.com> from accessing the site2 directory
This is mainly just to make sure that our other customers don't stumble across our hosted customer's site tied to our domain name.
I tried many variations of the following code with no luck, I also tried {REQUEST_URI} with no luck.
I could recreate the default virtual host into another directory, but because of many of the internal programs and scripts, this would cause a lot of extra work.
Thanks in advance for your time.
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.oursite\.com$ [NC]
RewriteRule (.*) - [F,L]
ASKER
No,
I just have it in a .htaccess file in the /var/www/html/site2 directory.
Should the <directory> tags be in the httpd.conf file or .htaccess file in the root directory?
Bill
I just have it in a .htaccess file in the /var/www/html/site2 directory.
Should the <directory> tags be in the httpd.conf file or .htaccess file in the root directory?
Bill
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fantastic! it works exactly as needed!
Thank you very much.
Bill
Thank you very much.
Bill
<Directory /var/www/html/site2>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.oursite\.com$ [NC]
RewriteRule ^ - [F,L]
</Directory>
section?