简体   繁体   English

.htaccess mod_rewrite给500错误

[英].htaccess mod_rewrite giving 500 error

I have an .htaccess file that has been working perfectly. 我有一个运行良好的.htaccess文件。 However, I just moved the website to a shared host and everything stopped working. 但是,我只是将网站移到了共享主机上,所以一切都停止了工作。

Here is my .htacces: 这是我的.htacces:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/preview/([^/]+)/?$ preview.php?c=$1&m=$2&i=$3 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/page/([^/]+)/?$ index.php?c=$1&m=$2&p=$3 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?c=$1&m=$2 [L]

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

I can't be sure but I think the problem is that hosting account is not at the root level. 我不确定,但我认为问题在于托管帐户不在根目录下。 Meaning I have one domain pointing to my hosting account, but then this domain www.website.com is pointing to the /website folder on the hosting account. 这意味着我有一个域指向我的托管帐户,但是此域www.website.com指向了托管帐户上的/website文件夹。

The error message is just: 错误消息是:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache Server at crstrains.com Port 80

And there is nothing generated in the error logs. 在错误日志中什么也没有生成。

I expect www.website.com/Policies to equal www.website.com/index.php?c=Policies, and it used to. 我希望www.website.com/Policies等于www.website.com/index.php?c=Policies,而且过去也是如此。 Not anymore. 不再。 How can I fix this? 我怎样才能解决这个问题?

您能否尝试在RewriteEngine On正下方添加RewriteBase /

Have you tried adding a RewriteBase /website/ directive after your RewriteEngine on statement? 您是否尝试过在RewriteEngine on语句之后添加RewriteBase /website/指令?

Checkout How does rewritebase work in .htaccess for more information about how to use RewriteBase . Checkout rewritebase如何在.htaccess中工作,以获取有关如何使用RewriteBase更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM