Forum Moderators: phranque
I allow users to have their own username as a subdomain and I use PHP script, mypage.php, to validate if a user is allowed to use the subdomain feature.
This PHP script search the database and if the user (the subdomain) is allowed, it will redirect the user to another page (PHP)
such as user1.domain1.com will be redirected to
www.domain1.com/index.php?param1=1¶m2=user1_id
everything is working fine until I added a new domain name and I also want to enable the catch all subdomain feature to the new domain (domain3). worst, it doesn't redirect anything at all. It just go to the main page whatever subdomain you type.
this is my .htaccess file :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.domain1\.com
RewriteRule (.*) [%1.domain1.com...] [R=301,L]
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.domain3\.com
RewriteRule (.*) [%1.domain3.com...] [R=301,L]
#
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http://(www\.)?domain1\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?domain2\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?domain3\.com [NC]
RewriteRule \.(jpe?g¦gif¦png¦bmp)$ - [F,NC]
#
RewriteCond %{REQUEST_URI}!^/mypage\.php
RewriteCond %{HTTP_HOST}!^www\.domain1\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain1\.com
RewriteCond %{HTTP_HOST}!^www\.domain3\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain3\.com
RewriteRule .* /mypage.php?%1 [L]
------- end
it seems .htaccess is doing nothing.
aside from that, I need to enable allow several sites to read images from domain1.com, what should I put in the .htaccess to allow otherdomain1 and otherdomain2 to read and load the images from domain1?
I can't use the Cpanel hotlink proctection because everytime I enable it, it mess with the .htaccess.
Thank you very much in advance.