htaccess的是表现在goddady奇怪,但一般在localhost [英] htaccess is behaving weird on goddady but normal on localhost

查看:175
本文介绍了htaccess的是表现在goddady奇怪,但一般在localhost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的本地主机,一切都很好。当我使用的是免费托管的网站,一切都很好了。我去GoDaddy的(之前,我与他们同在)的那一刻,一切都消失了南方。

我改变了DNS回默认GoDaddy的DNS设置和理解,它需要24-48更新。通常,当我在过去这样做,花了几个小时。

这是现在已经超过24小时,我的WiFi是无法访问该网站的唯一连接。它可以在我的手机,我的朋友的电脑上,就不是我的。我已经清除了DNS缓存,改变路由器的信道,重新启动路由器,并清理所有的cookies和历史记录。没有什么帮助。

我想我必须再等24小时,什么是错的。

在我去的网站上我的电话, www.bragdeal.com 的工作原理,但的 www.bragdeal.com/engineering.php 不会。

在我的根文件夹中我有engineering.php,和htaccess的删除的.php这样的域名应该www.bragdeal.com/engineering~~V

它工作正常,我在localhost /演示,但不能上网的www.bragdeal.com/engineering~~V

可能是什么问题?为什么会htaccess的工作就好在本地主机上和我之前使用的免费主机,而不是在服务器上GoDaddy的?

编辑:实时更新网址

编辑2:

 的ErrorDocument 400 /errors/400.php
ErrorDocument的401 /errors/401.php
ErrorDocument的403 /errors/403.php
ErrorDocument的404 /errors/404.php
ErrorDocument的500 /errors/500.php

选项​​-Indexes -MultiViews +的FollowSymLinks
RewriteEngine叙述上
的RewriteBase /

AddDefaultCharset UTF-8
SETENV SERVER_ADMIN support@bragdeal.com
FileETag无

#force HTTP
的RewriteCond%{} HTTPS上
(。*)重写规则的http://%{HTTP_HOST}%{REQUEST_URI} [R = 301,L]

#------------------删除的index.php --------------------------- ------
的RewriteCond%{} THE_REQUEST /(?:index)?(.*?)\.php[\s?] [NC]
重写规则^%1 [R = 302,L,NE]

的RewriteCond%{THE_REQUEST} ^ [AZ] {3,9} \ /(.*)指数($ | \ | \?)
重写规则^ /%1 [R,L]

#-------------------删除的.php --------------------------- --------------
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{DOCUMENT_ROOT} /%{REQUEST_URI} \ PHP -f [NC]
重写规则^(。+?)/?$ $ 1.PHP [L]

< IfModule mod_deflate.c>
  #的COM preSS HTML,CSS,JavaScript中,文本,XML和字体
  AddOutputFilterByType DEFLATE应用程序/ JavaScript的
  AddOutputFilterByType DEFLATE应用程序/的RSS + XML
  AddOutputFilterByType DEFLATE应用程序/ vnd.ms-fontobject
  AddOutputFilterByType DEFLATE应用程序/ x-字体
  AddOutputFilterByType DEFLATE应用程序/ x-字体OpenType字体
  AddOutputFilterByType DEFLATE应用程序/ x-字体OTF
  AddOutputFilterByType DEFLATE应用程序/ x-字体的TrueType
  AddOutputFilterByType DEFLATE应用程序/ x-字体,TTF
  AddOutputFilterByType DEFLATE应用程序/ x-j​​avascript的
  AddOutputFilterByType DEFLATE是application / xhtml + xml的
  AddOutputFilterByType DEFLATE应用程序/ XML
  AddOutputFilterByType DEFLATE字型/ OpenType字体
  AddOutputFilterByType DEFLATE字体/ OTF
  AddOutputFilterByType DEFLATE字体/ TTF
  AddOutputFilterByType DEFLATE图像/ SVG + XML
  AddOutputFilterByType DEFLATE图像/ X-图标
  AddOutputFilterByType DEFLATE文/ CSS
  AddOutputFilterByType DEFLATE text / html的
  AddOutputFilterByType DEFLATE文/ JavaScript的
  AddOutputFilterByType DEFLATE text / plain的
  AddOutputFilterByType DEFLATE为text / xml

  #删除浏览器的bug(仅用于真正老的浏览器)
  BrowserMatch ^的Mozilla / 4 GZIP只-text / html的
  BrowserMatch ^的Mozilla / 4 \ .0 [678]无GZIP
  BrowserMatch \ bMSIE!没有GZIP!GZIP只-text / html的
  头追加因人而异的User-Agent
< / IfModule>

< IfModule mod_expires.c>
  ExpiresActive上
  ExpiresByType text / html的连接以及0秒
  ExpiresByType图像/ GIF进入加1周
  ExpiresByType为image / jpeg进入加1周
  ExpiresByType图像/ PNG进入加1周
  ExpiresByType应用程序/ JavaScript的进入加1周
  ExpiresByType文本/ CSS进入加1周
< / IfModule>

# 1周
< FilesMatch\(ICO | PDF | FLV | JPG | JPEG | PNG | GIF | JS | CSS | SWF)$。>
页眉设置缓存控制最大年龄= 604800,公开
< / FilesMatch>

# 2天
< FilesMatch |&GT\(XML TXT)$。;
页眉设置缓存控制最大年龄= 172800,公众,必重新验证
< / FilesMatch>

# 2小时
< FilesMatch\(HTML | HTM | PHP | JS)$>
页眉设置缓存控制最大年龄= 7200,必重新验证
< / FilesMatch>

< ifModule mod_gzip.c>
  mod_gzip_on是
  mod_gzip_dechunk是
  mod_gzip_item_include文件\(HTML |?TXT | CSS | PHP | PL)。$
  mod_gzip_item_include处理^ CGI脚本$
  mod_gzip_item_include MIME ^文本/.*
  mod_gzip_item_include哑剧^应用程序/ x-j​​avascript的。*
  mod_gzip_item_exclude MIME ^图像/.*
  mod_gzip_item_exclude rspheader ^内容编码:*。* GZIP
< / ifModule>
 

解决方案

如果你有一个名为 /工程则mod_dir(视<$ C $的设置C> DirectorySlash )将自动追加一个斜杠(修理的URL),因此要求 /工程/&LT;的DirectoryIndex&GT; ,而不是 /engineering.php (您将要为其内部重写根据你的.htaccess规则 - 这不会发生)

如果该目录的索引文件不存在,那么你会得到一个403(例如的index.php ) - 这似乎是发生在这里

解决的办法是删除/重命名 /工程目录,或者设置 DirectoryIndex的关在.htaccess(虽然默认设置为)。

On my localhost, everything is fine. When I was using a free hosting website, everything was fine too. The minute I went to godaddy (I was with them before), everything has gone south.

I changed the DNS back to the default godaddy DNS settings and understand that it takes 24-48 to update. Typically when I did this in the past, it took a few hours.

It's now over 24 hours and my wifi is the only connection that cannot access the website. It works on my phone, on my friends computer, just not mine. I've cleared the DNS Cache, changed the router's channel, restarted the router, and cleaned all the cookies and history. Nothing helps.

I assume I just have to wait another 24 hours, or something is wrong

When I go on the website on my phone, www.bragdeal.com works, but www.bragdeal.com/engineering.php won't.

In my root folder I have engineering.php, and htaccess removes .php so the domain should be www.bragdeal.com/engineering

it works fine for me on localhost/demo but not online for www.bragdeal.com/engineering

what could be the issue? why would htaccess work just fine on localhost and the free host I used before, but not on the server on godaddy?

EDIT: updated real url

EDIT 2:

ErrorDocument 400 /errors/400.php
ErrorDocument 401 /errors/401.php
ErrorDocument 403 /errors/403.php
ErrorDocument 404 /errors/404.php
ErrorDocument 500 /errors/500.php

Options -Indexes -MultiViews +FollowSymlinks
RewriteEngine On
RewriteBase /

AddDefaultCharset utf-8
SetEnv SERVER_ADMIN support@bragdeal.com
FileETag none

#force HTTP
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

#------------------ remove index.php ---------------------------------
RewriteCond %{THE_REQUEST} /(?:index)?(.*?)\.php[\s?] [NC]
RewriteRule ^ %1 [R=302,L,NE]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index($|\ |\?)
RewriteRule ^ /%1 [R,L]    

#-------------------remove .php----------------------------------------- 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType image/gif "access plus 1 week"
  ExpiresByType image/jpeg "access plus 1 week"
  ExpiresByType image/png "access plus 1 week"
  ExpiresByType application/javascript "access plus 1 week"
  ExpiresByType text/css "access plus 1 week"
</IfModule>

# 1 WEEK
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

# 2 DAYS
<FilesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>

# 2 HOURS
<FilesMatch "\.(html|htm|php|js)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

解决方案

If you have a directory called /engineering then mod_dir (depending on the setting of DirectorySlash) will automatically append a slash (to "fix" the URL) and thus request /engineering/<DirectoryIndex> and not /engineering.php (which you would like to internally rewrite to according to your .htaccess rules - this doesn't happen).

If the directory index file (eg. index.php) does not exist then you'll get a 403 - which is what seems to be happening here.

The solution would be to remove/rename the /engineering directory, or set DirectoryIndex Off in .htaccess (although the default setting is On).

这篇关于htaccess的是表现在goddady奇怪,但一般在localhost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆