CodeIgniter Forums
.htaccess and subdomain folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: .htaccess and subdomain folder (/showthread.php?tid=49710)



.htaccess and subdomain folder - El Forum - 02-29-2012

[eluser]Silviu[/eluser]
I've googled for this for some time now, but I cannot seem to find a good answer....

I have recently a subdomain for my test application on my web server, and I want to prevent direct access to the subdomain folder, but to allow normal access.

So, if a user goes to domain.com/subdomain, he will get a deny/redirect/whatever, but if the same user goes to subdomain.domain.com, access will be permited.

How can I do that using a .htaccess placed in my application root (public_html/subdomain)?

Edit: I have managed to find a solution here:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/addonfolder/(.*)$
RewriteRule ^(.*)$ - [L,R=404]