我的测试网站是 frontshoppe.com
我在下面有以下.htaccess
。
RewriteEngine on RewriteCond %{HTTP_HOST} ^frontshoppe\.com$ RewriteRule (.*) http://www.frontshoppe.com/$1 [R=301,L] RewriteRule ^$ admin [L]
是的,加载很好,就像我希望它加载管理文件夹的内容.. 但我也想要网址..
www.frontshoppe.com只有..而不是
www.frontshoppe.com/admin
答案 0 :(得分:3)
这应该有效:
RewriteEngine on
# Change yourdomain.com to be your primary domain.
RewriteCond %{HTTP_HOST} ^(www.)?frontshoppe.com$
# Change 'subfolder' to be the folder you will use for your primary domain.
RewriteCond %{REQUEST_URI} !^/admin/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subfolder' to be the folder you will use for your primary domain.
RewriteRule ^(.*)$ /admin/$1
# Change yourdomain.com to be your primary domain again.
# Change 'subfolder' to be the folder you will use for your primary domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?frontshoppe.com$
RewriteRule ^(/)?$ admin/index.php [L]
答案 1 :(得分:0)
您可以遵守以下规则:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^frontshoppe\.com$
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L,NE]
RewriteCond %{THE_REQUEST} \s/+admin/(\S*) [NC]
RewriteRule ^ /%1 [L,R=302,NE]
RewriteRule ^((?!admin/).*)$ admin/$1 [L,NC]