我已经创建了一个子域,但当我在浏览器中访问它时,它给出了500内部服务器错误。
子域: sub.domain.com目录: /sub
下面是/上的htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule (.*) http://www.domain.com/ [L,R=301]
</IfModule>我是否需要在我的htaccesss文件中添加任何内容才能使其工作。
更新:
另外,我的主域工作得很好,没有问题。
<IfModule mod_rewrite.c>
RewriteEngine On
# NOTE: change this to your actual StatusNet base URL path,
# minus the domain part:
#
http://sub.domain.com/ => /
http://sub.domain.com/mublog/ => /mublog/
#
RewriteBase /mublog/
## Uncomment these if having trouble with API authentication
## when PHP is running in CGI or FastCGI mode.
#
#RewriteCond %{HTTP:Authorization} ^(.*)
#RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?p=$1 [L,QSA]
</IfModule>
<FilesMatch "\.(ini)">
Order allow,deny
</FilesMatch>发布于 2014-01-29 17:13:17
尝试更改规则的顺序:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
RewriteRule !^app/webroot/ app/webroot%{REQUEST_URI} [L,NC]
</IfModule>https://stackoverflow.com/questions/21426527
复制相似问题