404由于.htaccess文件而出错


404 errer due to .htaccess file

我有一个网站。在这个网站上,我有一些404文件找不到错误,根据我的谷歌网站管理员,尽管所有的文件都存在。它们如下:

http://firstcovers.net/http//firstcovers.net/
http://firstcovers.net/category/1/http//firstcovers.net/
http://firstcovers.net/category/8/4/http//firstcovers.net/
http://firstcovers.net/category/17/2/http//firstcovers.net/
http://firstcovers.net/category/20/2/http//firstcovers.net/
http://firstcovers.net/facebook-cover/1317/privacy.php
http://firstcovers.net/facebook-cover/1317/terms.php
http://firstcovers.net/facebook-cover/1286/privacy.php
http://firstcovers.net/facebook-cover/338/terms.php

.htaccess文件的结构如下:

DirectoryIndex index.html.var index.htm 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 default.htm default.html home.htm index.php5 Default.html Default.htm home.html
# Use PHP5 Single php.ini as default
#AddHandler fcgid-script .php
RewriteEngine On

RewriteRule ^latest.html /index.php?latest=y [L]
RewriteRule ^random.html /index.php?random=y [L]
RewriteRule ^showall.html /index.php?showall=y [L]
RewriteRule ^about.html /about.php [L]
RewriteRule ^userupload.html /userupload.php [L]
RewriteRule ^get-timeline.html /how.php [L]
RewriteRule ^facebook-cover-([0-9]+).html /detailpage.php?cp=$1 [L]
RewriteRule ^facebook-cover/([0-9]+)/([^/]*).html /detailpage.php?cp=$1 [L]
RewriteRule ^preview/([0-9]+)/([^/]*).html /detailpage.php?preview=y&cp=$1 [L]
RewriteRule ^category/([^/]*)/([^/]*).html /index.php?cat=$1 [L]
RewriteRule ^category/([^/]*)/([^/]*)/([^/]*).html /index.php?cat=$1&page=$2 [L]
RewriteRule ^cover-([0-9]+).html  /image.php?picID=$1 [L]
RewriteBase /
RewriteRule ^css/(.*'.css) /combine.php?type=css&files=$1
RewriteRule ^javascript/(.*'.js) /combine.php?type=javascript&files=$1
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
<FilesMatch "''.(js|css|html|htm|php|xml)$">
# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# remove browser bugs
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
SetOutputFilter DEFLATE
</FilesMatch>
Header set Expires "Thu, 15 Apr 2030 20:00:00 GMT"
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER}     !^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} .(gif|jpe?g?|png)$ [NC]
RewriteCond %{HTTP_REFERER}     !^https?://([^.]+.)?firstcovers. [NC]
RewriteRule .(gif|jpe?g?|png)$ - [F,NC,L]
</ifModule>
RewriteCond %{HTTP_REFERER} !^http://www.google.com/reader/view/.*$ [NC]
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On 
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
FileETag MTime Size

我已尽力更改.htaccess文件的正则表达式。但我还是犯了一些错误。我无法追查那个错误。

我请求这个网站的成员帮助我。

**提前谢谢。

你的朋友。

V K锯。**

对于以下404s

http://firstcovers.net/facebook-cover/1317/privacy.php
http://firstcovers.net/facebook-cover/1317/terms.php
http://firstcovers.net/facebook-cover/1286/privacy.php
http://firstcovers.net/facebook-cover/338/terms.php

修改您的facebook-cover规则以匹配.php URL。

RewriteRule ^facebook-cover/([0-9]+)/([^/]*)'.(php|html)$ /detailpage.php?cp=$1 [L]

其余404链接

http://firstcovers.net/http//firstcovers.net/
http://firstcovers.net/category/1/http//firstcovers.net/
http://firstcovers.net/category/8/4/http//firstcovers.net/
http://firstcovers.net/category/17/2/http//firstcovers.net/
http://firstcovers.net/category/20/2/http//firstcovers.net/

不是由.htaccess文件生成的。检查您的php代码中是否有错误生成的URL。它在某个地方的末尾附加了http//firstcovers.net/。您正在使用一些自定义标记(如<g:plusone>),这可能也是此类标记库中的一个错误。

这些是您提供的404错误的url

http://firstcovers.net/http//firstcovers.net/
http://firstcovers.net/category/1/http//firstcovers.net/
http://firstcovers.net/category/8/4/http//firstcovers.net/
http://firstcovers.net/category/17/2/http//firstcovers.net/
http://firstcovers.net/category/20/2/http//firstcovers.net/
http://firstcovers.net/facebook-cover/1317/privacy.php
http://firstcovers.net/facebook-cover/1317/terms.php
http://firstcovers.net/facebook-cover/1286/privacy.php
http://firstcovers.net/facebook-cover/338/terms.php

在提供的url中存在两组问题。让我们逐一解决这个问题。第一组url是:

http://firstcovers.net/facebook-cover/1317/privacy.php
http://firstcovers.net/facebook-cover/1317/terms.php
http://firstcovers.net/facebook-cover/1286/privacy.php
http://firstcovers.net/facebook-cover/338/terms.php

我访问了你的网页,发现代码为:

<a class="uibutton" href="#" onClick="newInvite(); return false;">Invite</a>
<a class="uibutton icon secure" onclick="privacy(); return false;">Privacy</a>
<a class="uibutton" onclick="terms(); return false;">Terms</a>

您必须更改代码以解决以下问题:

<a class="uibutton" href="#" onClick="newInvite(); return false;">Invite</a>
<a class="uibutton icon secure" href="#"  onclick="privacy(); return false;">Privacy</a>
<a class="uibutton" href="#" onclick="terms(); return false;">Terms</a>

在您的代码中,href="#"代码丢失,导致第一组url出现问题。在你的网址中,邀请不包括在404错误中,因此它将解决第一组网址问题。

第二组url:

http://firstcovers.net/http//firstcovers.net/
http://firstcovers.net/category/1/http//firstcovers.net/
http://firstcovers.net/category/8/4/http//firstcovers.net/
http://firstcovers.net/category/17/2/http//firstcovers.net/
http://firstcovers.net/category/20/2/http//firstcovers.net/

首先要提到的是,你的网站是动态的,你通过第三方工具(如python脚本)生成网站地图,或者可能是其他工具,这反过来又访问apache访问日志。由于url是唯一的,所以在网站地图中添加了url,并且没有url,因此出现404错误。

您的问题有两种解决方案:

  1. 要么从网站地图中删除不需要的url,比如这些导致问题的url。为此,您需要查看/阅读第三方工具文档。

  2. 无论你自己的网站名称在哪里再次出现,你都会将它们重定向到主页url,因为你知道正则表达式,所以这对你来说不是问题。