【发布时间】:2017-08-11 14:14:19
【问题描述】:
我遇到了一个问题,即 google 索引了一些 URL 错误的页面。
他们正在编入索引的 URL 是:
http://www.example.com/user/emp.php
和 HTML URL:
http://www.example.com/login.html
我需要它重定向到:
http://www.example.com/user/emp
和 HTML URL:
http://www.example.com/login
这是我的 .htaccess 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]
【问题讨论】:
-
更好的方法:让 Google 重新抓取您的网站。这是一个很好的答案:stackoverflow.com/questions/9466360/…
标签: php html apache .htaccess mod-rewrite