我有url链接区域ex。 http://mysite.it/index.php?page=search&sRegion=Toscana
可以使用htaccess来制作像toscana.mysite.it这样的网址 感谢答案
这是我的htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite\.it$ [NC]
RewriteCond %{QUERY_STRING} (^|&)sRegion=([^&]*) [NC]
RewriteRule ^index\.php$ http://%2.%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
答案 0 :(得分:0)
启用mod_rewrite
和.htaccess
至httpd.conf
,然后将此代码放入DOCUMENT_ROOT/.htaccess
文件中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite\.it$ [NC]
RewriteCond %{QUERY_STRING} (^|&)sRegion=([^&]+) [NC]
RewriteRule ^index\.php$ http://%2.%{HTTP_HOST}%{REQUEST_URI} [R=302,NC,L]