Cla*_*tem 0 php apache .htaccess mod-rewrite
我的测试网站是frontshoppe.com
我有以下内容.htaccess
。
重写引擎开启 RewriteCond %{HTTP_HOST} ^frontshoppe\.com$ RewriteRule (.*) http://www.frontshoppe.com/$1 [R=301,L] 重写规则 ^$ admin [L]
是的,它加载得很好,就像我希望它加载 admin 文件夹的内容一样..但我也希望 url 是..
仅 www.frontshoppe.com..
而不是
www.frontshoppe.com/admin
这应该有效:
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]
Run Code Online (Sandbox Code Playgroud)