![](/img/trans.png)
[英]Linux CentOS 7 - Configuration of httpd.conf file through .htaccess
[英]htaccess - displaying 500 Error even enabling the htaccess file in httpd.conf on localhost
.htaccess 显示 500 服务器错误。
文件的位置是根文件夹。 下面是代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .signup.php [L]
RewriteRule .* .signup.php [PT,L]
</IfModule>
我在 httpd.conf 文件中启用了 htaccess 文件
<Directory />
Options FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
Satisfy all
</Directory>
和
LoadModule rewrite_module modules/mod_rewrite.so
您的RewriteBase
行在没有指定目录的情况下有问题。
尝试: RewriteBase /
- RewriteBase /
- 完全删除该行。
如果这不起作用,我认为像这样编写 .htaccess 文件会更安全:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If we're already on .signup.php, exit so we don't get stuck in a loop
RewriteRule .signup.php - [L]
#If doesn't exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#rewrite to .signup.php and read from the top of .htaccess again
RewriteRule .* .signup.php [PT,L]
</IfModule>
这样我们就可以避免重定向循环,以防万一 .signup.php 文件也不存在..
如果这仍然不起作用,请尝试在没有 PT 标志的情况下进行测试,如果您不确定自己知道自己在做什么,它可能会使 .htaccess 复杂化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.