.htaccess将域映射到public_html内的子文件夹

时间:2018-06-27 10:29:20

标签: php apache .htaccess

我有一个用于系统https://theveganhut.co.uk的apache服务器;我需要在同一服务器上有不同的站点。因此,我将http://theveganhut.co.uk的文件放在theveganhut.co.uk文件夹中的文件夹public_html中。

我已通过根(theveganhut.co.uk)中的.htaccess文件将域theveganhut.co.uk映射到文件夹public_html

<IfModule mod_headers.c>
  Header set Access-Control-Allow-Origin "*"
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?theveganhut.co.uk$
RewriteCond %{REQUEST_URI} !^/theveganhut.co.uk/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /theveganhut.co.uk/$1
# Change example.com to be your main domain again.
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?theveganhut.co.uk$
RewriteRule ^(/)?$ /theveganhut.co.uk/ [L]

但是当我加载URL http://theveganhut.co.uk/admin时,可以看到管理员登录页面,但是URL更改为http://theveganhut.co.uk/theveganhut.co.uk/admin/。我希望网址为http://theveganhut.co.uk/admin/

.htaccess文件中是否缺少某些内容来解决此问题?请帮忙。

0 个答案:

没有答案