2014-02-21 83 views
1

我在使用wampserver(localhost)开发时为我的网站编写了下面的.htaccess代码。本地主机htaccess代码不能在真正的服务器上工作?

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase/

# external redirect from /category.php?id=name&phrase=something to /name/something 
RewriteCond %{THE_REQUEST} \s/+category\.php\?id=([^&]+)&phrase=([^\s&]+) [NC] 
RewriteRule^%1/%2? [R=302,L] 

# skip files and directories from rewrites 
RewriteCond %{REQUEST_FILENAME} -d [OR] 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule^- [L] 

# Cleans up all the article, and wrestler pages 
RewriteRule ^/?article/([^/]+)/?$ article.php?id=$1 [L,QSA] 
RewriteRule ^/?wrestler/([^/]+)/?$ wrestler.php?id=$1 [L,QSA] 

# Removes the .php extension from pages 
RewriteCond %{DOCUMENT_ROOT}/$1.php -f [NC] 
RewriteRule ^(.+?)/?$ $1.php [L] 

# For the redirecion of related topics links on wrestler profile pages 
RewriteRule ^([^/]+)/([^/]+)/?$ category.php?id=$1&phrase=$2 [L,QSA] 

我刚刚把网站带到真正的服务器上,我得到一个“500内部服务器错误”。

我是否应该从localhost到真正的服务器进行一些更改的代码?请帮帮忙。

+0

可能'FollowSymLinks'不是允许的选项,或者'mod_rewrite'被禁用。您是否尝试过注释“Options + FollowSymLinks”这一行? –

+0

我刚刚尝试过,并没有帮助。我很困惑。 – Vimzy

+0

什么是写入您的Apache错误日志的相关错误? – codnodder

回答

0

可能性非常好,这是活动服务器上禁用模块的问题。你应该能够访问你的服务器日志,看到引发这个错误的确切线,但我敢打赌,这是一个禁用的模块(在这种情况下,mod_rewrite可能没有启用您的服务器 - 我有几个这个问题的主机)。

根据您的主机和服务器上的配置级别,您可能需要联系支持人员并要求他们查看日志。

相关问题