Posts

Showing posts with the label .htaccess

create subdomains using htaccess

Its very quick and easy. Here we go You need to create a wildcard domain on your DNS server *.website.com  Then in your vhost container you will need to specify the wildcard aswell *.website.com - This is done in the ServerAlias DOCs  Then extract and verify the subdomain in PHP and display the appropriate data Here we go in some detail. Create a wildcard DNS entry -  In your DNS settings you need to create a wildcard domain entry such as *.example.com. A wildcard entry looks like this:  *.example.com.   3600  A  127.0.0.1 Include the wildcard in vhost -  Next up in the Apache configuration you need to set up a vhost container that specifies the wildcard in the ServerAlias DOCs directive. An example vhost container: <virtualhost> ServerName server.example.com ServerAlias *.example.com UseCanonicalName Off </VirtualHost> Work out which subdomain you are on in PHP - Then in your PHP scripts you can find out t...

How to ban an IP address or site name using .htaccess

Ban using IP address. These are sample IP addresses... 42.12.5.34 193.110.145.185 Code For .htaccess: <Limit GET POST> order allow,deny deny from 42.12.5.34 deny from 193.110.145.185 allow from all </Limit> To ban using site name. Do NOT include the "http://www." portion! These are sample site names:... domain.com abc.com ## SITE REFERRER BANNING RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} domain\.com [NC,OR] RewriteCond %{HTTP_REFERER} abc\.com [NC] RewriteRule .* - [F]