【发布时间】:2014-10-31 19:41:30
【问题描述】:
我的网址有问题,例如谷歌抓取了双 http
http://example.com/example.com/c-title-id.html
以及所有类似的相互链接的页面
请任何人帮助我用 .htacess 重定向所有带有 301 的 url
我的 htacess 代码是
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.website\.com [NC]
RewriteRule ^(.*)$ http://website.com/$1 [L,R=301]
RewriteRule category-([0-9]+)-(.*)-([0-9]+)\.html$ category.php?cid=$1&name=$2&page=$3.php [L]
RewriteRule search-(.*)-([0-9]+)\.html$ search.php?term=$1&page=$2.php [L]
RewriteRule all-covers-([0-9]+)\.html$ all-covers.php?page=$1.php [L]
RewriteRule index-([0-9]+)\.html$ index.php?page=$1.php [L]
RewriteRule featured-covers-([0-9]+)\.html$ featured-covers.php?page=$1.php [L]
RewriteRule top-downloaded-([0-9]+)\.html$ top-downloaded.php?page=$1.php [L]
RewriteRule c-([0-9]+)(.*)\.html$ cover.php?id=$1&name=$2.php [L]
RewriteRule sitemap.xml$ sitemap.php [L]
RewriteRule sitemap1.xml$ sitemap1.php [L]
RewriteRule rss.xml$ rss.php [L]
RewriteRule ^(.*)\.html$ $1.php [L]
ErrorDocument 404 /404.html
我想自动重定向所有这些。
【问题讨论】:
-
你在评论中说
http://example.com/example.com/c-title-id.html在你说http://example.com/http://example.com/c-title-id你需要确切知道它是什么。
标签: .htaccess mod-rewrite redirect url-rewriting http-status-code-301