我有一个网站。在这个网站中,尽管所有文件都存在,但根据我的谷歌网站管理员的说法,我有一些 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文件的正则表达式。但我仍然犯了一些错误。我无法追踪那个错误。
我请求本网站的成员帮助我。
**提前致谢。
你的 friend 。
V K 锯。**
最佳答案
对于以下 404
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
的规则网址也是如此。
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>
),这也可能是此类标签库中的一个错误。
关于php - .htaccess 文件导致 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29180580/