htaccess的不工作的GoDaddy的工作、htaccess、GoDaddy

2023-09-02 11:25:26 作者:深拥不弃

我最近搬到了GoDaddy的和的.htaccess似乎并没有工作。是否有这需要GoDaddy的工作要做,因为的.htaccess正在研究previous举办任何设置。我曾尝试使用搜索功能,但遗憾的是仍然不能得到它的工作。以下是的.htaccess文件目前在父目录我的code。我注意到一些人说,这需要3个小时的效果发生。但是,它已经现在已经几个星期,但仍然没有好。

 选项+了FollowSymLinks
RewriteEngine叙述上
重写规则^ work.html work.php
重写规则^ about.html about.php
重写规则^ services.html services.php
重写规则^的index.html的index.php
重写规则^ contact.html contact.php
 

解决方案

尝试禁用multiviews其中是在GoDaddy的通过默认。如果还是不行,请尝试在的.htaccess 设置一个环境变量,看看你是否可以通过PHP访问:

 选项+了FollowSymLinks -Multiviews

< IfModule mod_rewrite.c>

    SETENV HTTP_MOD_REWRITE在
    RewriteEngine叙述上
    的RewriteBase /
    的RewriteCond%{REQUEST_URI}([^。] +)。HTML $
    重写规则^ *%1.PHP [L]

< / IfModule>
 

另存为像 modRewrite_check.php

 < PHP

 如果(!空($ _ SERVER ['HTTP_MOD_REWRITE'])){
     回声mod_rewrite的运行;
 } 其他 {
     回声mod-rewrite没有运行;
 }

?>
 
对比分析帮你轻松选择国外虚拟主机

I recently moved to godaddy and the .htaccess doesn't seem to work. Are there any settings which need to be done for godaddy because the .htaccess was working on previous hosting. I have tried to use the search feature but unfortunately couldn't still get it to work. Following is my code of .htaccess the file is currently in the parent directory. I noticed some people saying that it takes 3 hours for the effect to take place. But it has already been a few weeks now but still no good.

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^work.html work.php
RewriteRule ^about.html about.php
RewriteRule ^services.html services.php
RewriteRule ^index.html index.php
RewriteRule ^contact.html contact.php

解决方案

Try to disable multiviews which are on in GoDaddy by default. If that doesn't work, then try to set an environment variable in .htaccess and see if you can access it via PHP:

Options +FollowSymLinks -Multiviews

<IfModule mod_rewrite.c>

    SetEnv HTTP_MOD_REWRITE On
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_URI} ([^.]+).html$
    RewriteRule ^.* %1.php [L]

</IfModule>

Save this as something like modRewrite_check.php:

<?php

 if(!empty($_SERVER['HTTP_MOD_REWRITE'])){
     echo "Mod_Rewrite is running";
 } else {
     echo "Mod Rewrite is not running";
 }

?>