【问题标题】:.htaccess rules cause 500 Internal error in my second domain.htaccess 规则在我的第二个域中导致 500 内部错误
【发布时间】:2014-02-18 02:41:12
【问题描述】:

我在同一个主机上有两个网站,我的根网站使用 .htaccess,我可以成功浏览它,但我的第二个域向我发送 500 Internal server error 。如果我删除 .htaccess,我可以很好地浏览这两个网站,但我的第一个网站需要 .htaccess。

.htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|uploads|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ index.php/$1 [L]

文件结构

-js
-css
-second-domain.com ( here lies my second domain, i cant browse it , 500 internal server problem )
-upload
.htaccess
index.php
sitemap.xml

我确实希望有人给我正确的命令来输入 .htaccess 以便能够访问我的第二个域,在此先感谢。

【问题讨论】:

  • 有时我们可以通过启用 mod_rewrite 模块来解决这个问题

标签: php apache .htaccess


【解决方案1】:

你应该有这个:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]

【讨论】:

  • 它只将不存在的目录/文件重写为 index.php。因此,您现有的目录/文件将不再有任何问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-23
  • 1970-01-01
  • 2016-01-28
  • 2021-09-28
相关资源
最近更新 更多