如何在ipage.com中的网站filemanager中配置我的.htaccess文件?

时间:2014-10-31 15:42:56

标签: php html .htaccess

我正在和ipage.com的操作员聊天,我试图创建我自己的.htaccess文件并上传它然后他们尝试创建.htaccess文件并将其配置几乎两天而没有解决方案

问题是.htaccess文件位于我的根目录中,但它不能与所有子目录一起使用,如果有,那么我就无法浏览我的常规主网站。< / p>

第一次修复.htaccess文件以使用我创建并上传到我网站的新html文件:

Testing html file

此文件的内容为:

<HTML>
    <HEAD>
    <TITLE>Use PHP in HTML files</TITLE>
    </HEAD>

    <BODY>
        <h1>
        <?php echo "It works!"; ?>
        </h1>
    </BODY>
</HTML>

我试图在html文件中使用php代码。 现在这不起作用,但如果他们在.htaccess文件中更改某些内容,testingphp.html将会有效,我会看到&#34;它有效!&#34;但是如果我要浏览/浏览我的常规主站点:

Main site page

然后我会收到这个错误:

  

内部服务器错误

     

服务器遇到内部错误或配置错误   无法完成您的请求。

     

请与服务器管理员联系,告知他们时间   发生了错误,以及您可能做过的任何事情   导致错误。

     

有关此错误的详细信息可能在服务器错误中可用   日志中。

他们将其更改回来我可以浏览我的网站,但随后testingphp.html无法工作,它将无法显示&#34;它有效!&#34;什么时候我会浏览它。 问题是每次只有一个页面正在工作。

我想要做的是在我的文件管理器的根目录中创建.htaccess文件,该文件将用于所有现有的html文件和子目录以及将来创建的所有未来的html文件并上传到文件管理器

qustion是:

为什么.htaccess文件不起作用? 我在ipage.com的文件管理器中找不到.htaccess文件,所以这是.htaccess文件的内容,也许有人可以看到该错误或知道如何解决问题?

# Begin cache control #
ExpiresActive on
ExpiresActive off
<FilesMatch ".*">
Header unset Cache-Control
Header unset Expires
Header unset Last-Modified
FileETag None
Header unset Pragma
</FilesMatch>
# End cache control #
DirectoryIndex index.php index.html index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm home.htm default.htm index.fcgi


#Weebly Additions Start
DirectoryIndex index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm home.htm default.htm index.fcgi
ErrorDocument 404 /404.php
ErrorDocument 403 /404.php

Options -Indexes
# Send send no-cache headers for root (/) and (.html) files
SetEnvIf Request_URI "(^/|\.html)$" HTML_FILE
Header add Pragma "no-cache" env=HTML_FILE
Header add Cache-Control "no-cache, no-store, max-age=0, must-revalidate" env=HTML_FILE
Header add Expires "-1" env=HTML_FILE




RewriteEngine On


# stop condition
RewriteRule ^mobile/.*$ - [L]

#Redirect urls based on a query string parameter
RewriteCond %{QUERY_STRING} ^(.*&)?view=mobile([^&]*)&?(.*)?$
RewriteRule ^(.*)$ /$1?m%1%3 [CO=is_mobile:1:%{HTTP_HOST},CO=disable_mobile:0:%{HTTP_HOST},L,R]

RewriteCond %{QUERY_STRING} ^m*(.*&)?view=full([^&]*)&?(.*)?$
RewriteRule ^(.*)$ /$1?%1%3 [CO=disable_mobile:1:%{HTTP_HOST},L,R]

# only process HTML files
# ----------------------------------------------------

RewriteRule (^|\.html)$ - [S=1]
        # is an html file, start the tests...

RewriteRule .* - [S=9]
        # NOT html file, skip past mobile rules...


# tests
# ----------------------------------------------------

RewriteCond %{QUERY_STRING} ^mobile$
RewriteRule ^(.*)$ /$1?m [CO=is_mobile:1:%{HTTP_HOST},CO=disable_mobile:0:%{HTTP_HOST},L,R]
        # set cookies, redirect...

RewriteCond %{QUERY_STRING} ^full$
RewriteRule ^(.*)$ /$1? [CO=disable_mobile:1:%{HTTP_HOST},L,R]
        # set cookies, redirect...

RewriteCond %{HTTP_COOKIE} (^|;)\s*is_mobile=0
RewriteRule .* - [S=6]
        # skip past mobile rules...

RewriteCond %{HTTP_COOKIE} (^|;)\s*disable_mobile=1
RewriteRule .* - [S=5]
        # skip past mobile rules...

RewriteCond %{HTTP_COOKIE} (^|;)\s*is_mobile=1
RewriteRule .* - [S=2]
        # go to mobile rules...

RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(\ |\/)|klon|kpt\ |kwc\-|kyo(c|k)|le(no|xi)|lg(\ g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-|\ |o|v)|zz)|mt(50|p1|v\ )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v\ )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|\ )|webc|whit|wi(g\ |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-) [NC]
RewriteRule .* - [CO=is_mobile:1:%{HTTP_HOST},S=1]
        # go to mobile rules...

RewriteRule .* - [CO=is_mobile:0:%{HTTP_HOST},S=2]
        # set cookie, skip past mobile rules...


# mobile rules
# ----------------------------------------------------

RewriteRule ^$ /mobile/index.html [S=1,PT]

RewriteRule ^(.*)$ /mobile/$1 [PT]
#Weebly Additions End

.htaccess文件中,我用weebly.com来编辑我的网站,但是现在我不再使用weebly.com我使用的是ipage.com filemanager我的网站在ipage.com上托管的地方

原因是我读到了大概不支持php和ipage.com支持。 那么也许有办法将.htaccess文件更改为不能与weebly一起使用,但仅限于使用hoster ipage.com?

在我的文件管理器中,还有一个名为.htacces.config的文件名,但此文件为空。

此外,我看到一个名为.htaccess.swp的文件,但我无法对其进行编辑,也无法看到它的内容。

最后还有一个名为.htaccess.txt的文件,其内容为:

AddType application/x-httpd-php .html .htm

也许有人在这里可以找到问题为什么.htaccess不能处理所有html文件的所有子目录和我上传或创建新文件的所有html文件?

我创建的唯一文件是.htaccess.txt,我上传了文件,而.htaccess.config也是空的。

名为.htaccess的{​​{1}}文件由ipage.com运营商/助手创建。 但到目前为止没有任何工作。

1 个答案:

答案 0 :(得分:0)

实际上,这是因为Wordpress无法在.htaccess中创建Filemanager文件。

我遇到了同样的问题,但是对我有用的是:

  1. 进入Filemanager的根目录
  2. 创建一个名为.htaccess的扩展名为.htaccess的新文件。
  3. 现在转到WordPress Admin Panel并移至settings/permalinks,然后单击save changes按钮。

它将在最近创建的code中为您生成file

如果Wordpress比您这样做失败,它将在页面末尾显示一些code

只需copy代码并将其paste手动保存在文件中。

相关问题