在服务器中使用 htaccess 时出现 500 错误
500 error while using htaccess in server
我在本地主机上有项目,我应用重写简单规则,它在本地主机上工作正常。当我在 cpanel 中上传时。重写 url (htaccess) 仅适用于一个页面,但不适用于其他页面。意味着它给我 500 个内部错误。我将 Profile.php 转换为域。com/profile 并将 about-us.php 转换为域。com/about-us 但它给了我 500 错误
# Turn Rewrite Engine On
RewriteEngine on
RewriteRule ^profile$ Profile.php [NC,L]
RewriteRule ^profile-setting$ User-Profile.php [NC,L]
RewriteRule ^checkout$ checkout.php [NC,L]
RewriteRule ^summer-store$ product.php [NC,L]
只有最后一个 product.php 页面在 localhost 和 cpanel 中工作,但其他页面只在 localhost 上工作而不在 cpanel 中工作(500 错误)。问题在哪里 Exist.Many 提前致谢
如果您拥有托管网站的服务器的根访问权限,只需使用根用户登录服务器并在浏览有问题的页面时检查路径 /usr/local/apache/logs/error_log 中的日志。错误日志会告诉你发生了什么,然后你可以相应地应用修复。
我在本地主机上有项目,我应用重写简单规则,它在本地主机上工作正常。当我在 cpanel 中上传时。重写 url (htaccess) 仅适用于一个页面,但不适用于其他页面。意味着它给我 500 个内部错误。我将 Profile.php 转换为域。com/profile 并将 about-us.php 转换为域。com/about-us 但它给了我 500 错误
# Turn Rewrite Engine On
RewriteEngine on
RewriteRule ^profile$ Profile.php [NC,L]
RewriteRule ^profile-setting$ User-Profile.php [NC,L]
RewriteRule ^checkout$ checkout.php [NC,L]
RewriteRule ^summer-store$ product.php [NC,L]
只有最后一个 product.php 页面在 localhost 和 cpanel 中工作,但其他页面只在 localhost 上工作而不在 cpanel 中工作(500 错误)。问题在哪里 Exist.Many 提前致谢
如果您拥有托管网站的服务器的根访问权限,只需使用根用户登录服务器并在浏览有问题的页面时检查路径 /usr/local/apache/logs/error_log 中的日志。错误日志会告诉你发生了什么,然后你可以相应地应用修复。