How To Safely Redirect /index.php To / Using .htaccess / Apache如何安全重定向/的index.php /使用。 htaccess的/阿帕奇
Any PHP based software like WordPress, Mambo, Joomla, Drupal, MODx etc. will serve pages both from http://your-site.com as well as http://your-site.com/index.php .任何基于PHP的软件一样,在WordPress ,曼波, joomla , drupal , modx等,将服务的页面都从http://your-site.com以及http://your-site.com/index.php 。 This creates duplicate content for search engines, which may then decide to penalize your site for duplicate content.这将创建重复的内容为搜索引擎,其中可能,然后才决定要惩罚您的网站,重复的内容。 You can safely prevent duplicate content with the following apache code / directive added to your .htaccess file (or in httpd.conf):您可以放心地防止重复的内容与下列的Apache代码/指令添加到您的。 htaccess的文件(或在httpd.conf ) :
RewriteEngine On关于rewriteengine
#Redirect plain index.php to home page without index.php #重定向平原的index.php首页没有的index.php
RewriteCond %{IS_SUBREQ} false rewritecond % ( ) is_subreq虚假
RewriteRule ^/index\.php$ http://blog.taragana.com [R=301,L] rewriterule ^ /指数\ 。 PHP的美元http://blog.taragana.com [ r = 301 ,升]
Replace http://blog.taragana.com with the url of your own site.取代http://blog.taragana.com与您自己网站的URL 。
What it does is redirect (301 - permanent redirect) all access to /index.php to /什么它是重定向( 301 -永久重定向)的所有访问/的i ndex.php/
However it does not redirect for internal requests.不过,这并不重定向内部的要求。 This is very important because when you are fetching http://blog.taragana.com, Apache actually creates an internal redirect to http://blog.taragana.com/index.php这是非常重要的,因为当你是撷取http://blog.taragana.com ,阿帕奇其实创建一个内部重定向到http://blog.taragana.com/index.php
The RewriteCond above ensures that only external accesses (from browsers, search engine bots etc) are only redirected to the canonical url of the site.该rewritecond以上,确保只有外部的通道(从浏览器,搜索引擎漫游器等) ,只是重定向到典型的网站的网址。
Also it doesn’t redirect requests like this也没有请求重定向喜欢这个 http://blog.taragana.com/index.php/archive/java-application-security-through-static-analysis/ , which contains index.php as part of the url. ,其中包含的index.php的一部分,该网址。 Only the exact url http://blog.taragana.com/index.php is redirected to http://blog.taragana.com只有确切网址http://blog.taragana.com/index.php重定向到http://blog.taragana.com
Filed under提起下 Headline News头条新闻 , , How To如何 , , Linux Linux的 , , Web网页 , , Web Hosting虚拟主机 | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article电子邮件此文章
You may also like to read您也可以想读 |




