在我的本地主机上,没有问题,但是当我将 .htaccess 文件上传到我的 1and1 托管帐户时,我遇到了障碍(内部 500 服务器错误)
更新:我发现了有问题的代码,只是不知道为什么它被破坏或如何修复它(我注释掉了断线)
#RewriteRule ^([a-zA-Z_\-/]+)(\/?)$ index.php?p=$1 [R,NC,QSA,L]
RewriteRule ^([a-zA-Z_/]+)(\/?)$ index.php?p=$1 [R,NC,QSA,L]
.htaccess 文件内容:
AddType x-mapp-php5 .php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteRule ^([a-zA-Z_\-/]+)(\/?)$ /index.php?p=$1 [L]
注释掉最后一行 (RewriteRule...) 会阻止错误的发生,但我显然需要它来运行。
该文件在我的本地机器上对我来说很好。好吧,它有点不同,所以我也会包含该代码(差异:标志、'/NEP' 和第一行)
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteRule ^([a-zA-Z_\-/]+)(\/?)$ /NEP2/index.php?p=$1 [NC,QSA,L]
我正在尝试执行的重写的几个示例:
dev.mydomain.com/services/ => dev.mydomain.com/index.php?p=services
dev.mydomain.com/quality/control => dev.mydomain.com/index.php?p=quality/control
您能提供的任何帮助/建议将不胜感激。我真的需要在一天结束之前完成这项工作。