Virtual sub domains:help me please

Alles, was den Apache betrifft, kann hier besprochen werden.

Virtual sub domains:help me please

Postby mohash » 03. December 2010 15:30

Hi
i convert : khazaen.ir/site/index.php?g=meysam to meysam.khazaen.ir with this code :in .htaccess

RewriteCond %{HTTP_HOST} ^([^\.]+)\.khazaen\.ir [NC]
RewriteCond %1 !^(www|ftp|mail|webmail)$ [NC]
RewriteRule ^$ /site/index.php?g=%1 [L]

but ...
How I can convert?
khazaen.ir/site/news_dt.php?g=meysam&id=12 to meysam.khazaen.ir/news_dt.php?id=12

(with 2 parametr)
mohash
 
Posts: 1
Joined: 03. December 2010 15:20

Re: Virtual sub domains:help me please

Postby Nobbie » 04. December 2010 13:36

*not yet tested* !!

Code: Select all
RewriteEngine On
RewriteCond %{QUERY_STRING} ^g=(.*)&id=(.*)$
RewriteRule ^site/([^/]+)$ http://%1.%{HTTP_HOST}/$1?id=%2 [R=301]
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 3 guests