jeudi 16 avril 2015

Virtual subdomains using .htaccess

I am trying to create virtual subdomains using .htaccess and wordpress. But it won't seem to work properly. Using wordpress I get urls like: http://ift.tt/1INBf25


I managed to rewrite this to what i want: http://ift.tt/1D6gEOr


But when this url is rewritten the page returns an 500 internal server error.


I also made a wildcard for the subdomains in my dns configuration.


Do I have to make subfolders for each subdomain in my root ?


My current .htaccess code is:



<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^([a-z]{2})\.hypnose\.eu$ [NC]
RewriteCond %{THE_REQUEST} \ /+([^\?]*)\?lang=([a-z]{2})&?([^\ ]*)
#RewriteRule ^ http://%2.hypnose.eu/%1?%3 [L,R]

RewriteCond %{QUERY_STRING} !(^|&)lang=
RewriteCond %{HTTP_HOST} ^([a-z]{2})\.hypnose\.eu$ [NC]
RewriteRule ^(.*)$ /$1?lang=%1 [L,QSA]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]
</IfModule>


Can anyone tell me what did I do wrong?


Aucun commentaire:

Enregistrer un commentaire