Php Localhost htaccess代码在真实服务器上不工作?

Php Localhost htaccess代码在真实服务器上不工作?,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,在使用wampserver(localhost)开发网站时,我为我的网站编写了下面的.htaccess代码 我刚刚在一台真正的服务器上直播了这个网站,我得到了一个“500内部服务器错误” 当我从本地主机转到真正的服务器时,是否应该对代码进行一些更改?请帮助大家。这很可能是由于live server上的模块被禁用而导致的问题。您应该能够访问服务器日志并查看引发此错误的确切行,但我敢打赌这是一个禁用的模块(在这种情况下,您的服务器可能没有启用mod_rewrite——我有几个主机出现此问题) 根据您

在使用wampserver(localhost)开发网站时,我为我的网站编写了下面的.htaccess代码

我刚刚在一台真正的服务器上直播了这个网站,我得到了一个“500内部服务器错误”


当我从本地主机转到真正的服务器时,是否应该对代码进行一些更改?请帮助大家。

这很可能是由于live server上的模块被禁用而导致的问题。您应该能够访问服务器日志并查看引发此错误的确切行,但我敢打赌这是一个禁用的模块(在这种情况下,您的服务器可能没有启用mod_rewrite——我有几个主机出现此问题)


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

可能不允许使用
FollowSymLinks
,或者禁用了
mod_rewrite
。你有没有试过从
选项+FollowSymLinks
行开始注释呢?我只是试了一下,没用。我太糊涂了。写入Apache错误日志的相关错误是什么?
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]