Forum Moderators: phranque
but some how im doing somthing wrong
i tried this in the .htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\..+\..*$ [NC]
RewriteCond /home/httpd/vhosts/mydomain.com/httpdocs/%1!-d
RewriteCond /home/httpd/vhosts/mydomain.com/httpdocs/%1!-l
RewriteRule ^(.*)$ [mydomain.com...]
but this returns an internal server error 500
my provider said that the apache server is setup write
but some how i cant get it to work.
does any body a have an id?
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9]+)\..+\..*$ [NC]
RewriteRule ^.* - [E=host:%2]
RewriteCond /home/httpd/vhosts/mydomain.com/httpdocs/%{ENV:host} !-d
RewriteCond /home/httpd/vhosts/mydomain.com/httpdocs/%{ENV:host} !-l
RewriteRule ^(.*)$ http://www.mydomain.com/index.php?sub=%{ENV:host} [R=301,L] Should a redirect take place? If yes, you should use the R=301 flag forcing a 301 redirect.
What should happen if www.sub.domain.com is called? Should the variable sub have the value www or sub?
Bob
the sub domain shoul be redirected to the profile of the user..
how should the new htaccess look like when using
R=301 flag forcing a 301 redirect.
and "www" should be the main http;//www.domain.com/index.php site and everything esle should be www.domain.com/index.php?sub=%1
know what i mean?
RewriteEngine on
# host is not www.domain.com
RewriteCond %{HTTP_HOST}!www\.([a-z0-9@_-]+)\.[a-z]{2,6} [NC]
#host is either www.sub.domain.com or sub.domain.com
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9]+)\.([a-z0-9@_-]+)\.[a-z]{2,6} [NC]
#set ENV
RewriteRule ^.* - [E=host:%2]
#if ENV:host exsists
RewriteCond %{ENV:host} .
#test, if string is not a directory
RewriteCond /home/httpd/vhosts/mydomain.com/httpdocs/%{ENV:host} !-d
or a symbolic link
RewriteCond /home/httpd/vhosts/mydomain.com/httpdocs/%{ENV:host} !-l
#if yes, force external redirect for the root request to...
RewriteRule ^$ http://www.mydomain.com/index.php?sub=%{ENV:host} [R=301,L]
and then it previews the main site.
RewriteEngine on
RewriteCond %{HTTP_HOST}!www\.([a-z0-9@_-]+)\.[a-z]{2,6} [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9]+)\.([a-z0-9@_-]+)\.[a-z]{2,6} [NC]
RewriteRule ^.* - [E=host:%2]
RewriteCond %{ENV:host} .
RewriteCond /home/httpd/vhosts/b2control.com/httpdocs/%{ENV:host}!-d
RewriteCond /home/httpd/vhosts/b2control.com/httpdocs/%{ENV:host}!-l
when i change this line instead of index using a different file like users.php
RewriteRule ^$ [b2control.com...] [R=301,L]
it also previews the index.php :S
do you have an other id?
This is only partially true. You cannot access backreferences in the pattern of a RewriteCond, that is, in the right-hand side of the line. But in the left side, you can back-reference the previous RewriteCond's variables using %1 through %9, and access the following RewriteRule's variables using $1 through $9. The same is true for accessing server environment variables.
The code above can be significantly simplified by taking advantage of this and eliminating unnecessary complexities.
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.
RewriteRule .* http://www.mydomain.com/index.php?sub=%1 [R=301,L]
RewriteRule .* /index.php?sub=%1 [L]
RewriteCond %{DOCUMENT_ROOT}%1 !-d
And going all the way back to the beginning of this thread, when you get the server error, what does your error log say?
Jim
Yeah the path is correct checked it several times.
jdMorgan,
Thanx will check it right away.
and im unable to check the apache log file :(
unfortunatly its the server of an provider
how can i set the htaccess so that the subdomain
stay's visible?
like when someone visits [nicklorion.b2control.com...]
the htaccess forwards it to [b2control.com...]
how can i make it so that shows [nicklorion.b2control.com...]
?