Forum Moderators: phranque
However, I now want to introduce a subdomain for my forum (eg: forum.mydomain.com) however, this means problems with both the above two rules:-
a) I end up with www.forum.mydomain.com
b) No images are shown for for forum
I'm wondering if someone can look at my mess of an HTACCESS and tell me how to change it to only allow www.mydomain.com and forum.mydomain.com, and only to allow images to by pulled from those.
ErrorDocument 404 /filenotfound.html
AddType text/x-server-parsed-html .html
IndexOptions -FancyIndexing
RewriteEngine On
RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www. ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)¦.*)$ [OR,NC]
RewriteCond %{HTTP_HOST}/www. ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))$ [NC]
RewriteRule ^ http://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301]
RewriteCond %{HTTP_REFERER}!^http://www.mydomain.com [NC]
RewriteRule [^/]+.(gif¦jpg)$ - [F]
I was trying something like this, but it's invalid and I have no idea why :(
ErrorDocument 404 /filenotfound.html
AddType text/x-server-parsed-html .html
IndexOptions -FancyIndexing
RewriteEngine On
RewriteCond %{HTTP_HOST}!^(www¦forum).mydomain.com
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
RewriteCond %{HTTP_REFERER}!^http://(www¦forum).mydomain.com [NC]
RewriteRule [^/]+.(gif¦jpg)$ - [F]
ErrorDocument 404 /filenotfound.html
AddType text/x-server-parsed-html .html
IndexOptions -FancyIndexing
RewriteEngine on
#
RewriteCond %{HTTP_HOST} !^(www¦forum)\.example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_REFERER} !^http://(www¦forum)\.example\.com
RewriteRule \.(gif¦jpg)$ - [F]
Jim