Forum Moderators: phranque
this is how my .htaccess looks like, do I really need to convert this to httpd.conf code to make my redirection work again? the host said they are willing to inject the code in httpd.conf themselves if I can provide it.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.sample3\.ccc
RewriteRule (.*) [%1.sample1.ccc...] [R=301,L]
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.sample2\.ccc
RewriteRule (.*) [%1.sample1.ccc...] [R=301,L]
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.sample1\.ccc
RewriteRule (.*) [%1.sample1.ccc...] [R=301,L]
#
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http://(www\.)?sample3\.ccc [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?sample2\.ccc [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?sample1\.ccc [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?sample4\.ccc [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?sample5\.ccc [NC]
RewriteRule \.(jpe?g¦gif¦png¦bmp)$ - [F,NC]
#
RewriteCond %{REQUEST_URI}!^/mypage\.php
RewriteCond %{HTTP_HOST}!^www\.sample1\.ccc
RewriteCond %{HTTP_HOST} ^([^.]+)\.sample1\.ccc
RewriteRule .* [sample1.ccc...] [R]
RewriteCond %{REQUEST_URI}!^/mypage\.php
RewriteCond %{HTTP_HOST}!^www\.sample3\.ccc
RewriteCond %{HTTP_HOST} ^([^.]+)\.sample3\.ccc
RewriteRule .* [sample1.ccc...] [R]
RewriteCond %{REQUEST_URI}!^/mypage\.php
RewriteCond %{HTTP_HOST}!^www\.sample2\.ccc
RewriteCond %{HTTP_HOST} ^([^.]+)\.sample2\.ccc
RewriteRule .* [sample1.com...] [R]
Thanks in advance.
I suspect that what they said was that you need to edit httpd.conf to define wildcard subdomains. Otherwise, the server will not recognize any subdomains at all (except, in all likelihood, "www").
The relevant directive for use in httpd.conf is "ServerAlias," as described in the Apache core directives and Name-Based Virtual Server documentation. This can be used to tell the server that " *.example.com " is an alias for "example.com", as is "www.example.com".
The remaining question, which you may be able to answer from your host's previous reply, is whether you have permissions to edit httpd.conf. If not, ask them to do it -- It's an easy edit and no big deal IF you've done it before.
Jim
The relevant directive for use in httpd.conf is ServerAlias [httpd.apache.org], as described in the Apache core directives and Name-Based Virtual Server documentation. This can be used to tell the server that " *.example.com " is an alias for "example.com", as is "www.example.com".
If you define wildcard subdomains using the ServerAlias directive and restart your server, your code will most likely work again without any changes.
Jim