【发布时间】:2014-09-25 22:06:17
【问题描述】:
我有一个运行良好的 .htaccess 文件。但是,我刚刚将网站移至共享主机,一切都停止了工作。
这是我的 .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]
我不能确定,但我认为问题在于托管帐户不在根级别。意思是我有一个域指向我的主机帐户,但是这个域 www.website.com 指向主机帐户上的 /website 文件夹。
错误信息只是:
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
并且错误日志中没有生成任何内容。
我希望 www.website.com/Policies 与 www.website.com/index.php?c=Policies 相等,而且它曾经如此。不再。我该如何解决这个问题?
【问题讨论】:
-
您是否尝试在
RewriteEngine on语句之后添加RewriteBase /website/。 stackoverflow.com/questions/704102/… -
@KristerAndersson 我没有尝试过,但似乎没有帮助。我确实尝试修改
/([^/]+)s 的数量并让它抛出 404,说 /website/website/index.php 找不到... -
@Prix 正如我在问题中所说,错误日志中没有生成任何内容。
-
@KristerAndersson 实际上,
RewriteBase /是我所需要的,这就成功了。 -
@sharf - 我将评论添加为简短回答 =)
标签: php apache .htaccess mod-rewrite