修复htaccess文件的格式错误

时间:2017-08-17 09:40:40

标签: apache .htaccess

我有这个.htaccess文件

RewriteEngine onRewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/jedpanel\.com\/" [R=301,L]
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
# BEGIN WordPress
<IfModulemod_rewrite.c>
RewriteEngine OnRewriteBase 
/RewriteRule^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>

# END WordPress

但我有一个问题。当我保存它时出错了,格式改变了。我试图解决它,但这就是我得到的。任何人都可以修复它,因为网页提供了500 Internal Server error

2 个答案:

答案 0 :(得分:0)

立即尝试:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^xinlongboard\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.xinlongboard\.com$
RewriteRule ^/?$ "http\:\/\/jedpanel\.com\/" [R=301,L]

# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

我不太清楚你在做什么来搞乱你的格式。下次只通过您的主机进行编辑,可以防止这种混乱。

答案 1 :(得分:0)

我自己修好了。 如果有人有兴趣,这是代码:

&#13;
&#13;
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xinlongboard\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.xinlongboard\.com$
RewriteRule ^/?$ "http\:\/\/jedpanel\.com\/" [R=301,L]
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
&#13;
&#13;
&#13;