试过在线的 htaccess 转换服务,基本都不行,这个问题困扰很久了,期待高人指点!
重写规则实现的是多级子目录转换为二级域名绑定,如 http://www.aaa.com/news/a1/b5/xc/admin/index.php?id=1 转换为 http://shop.aaa.com/index.php?id=1 访问
以下为 apache 的重写规则
RewriteEngine on
RewriteCond %{HTTP_HOST} ^shop.aaa.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^shop.aaa.com$
RewriteCond %{REQUEST_URI} !^/news/a1/b5/xc/admin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /news/a1/b5/xc/admin/$1
RewriteCond %{HTTP_HOST} ^shop.aaa.com$
RewriteRule ^(/)?index.php$ news/a1/b5/xc/admin/index.php [L]