从旧的Joomla(曼波)的网站使用的.htaccess自定义301重定向到新的Drupal 7网站 [英] custom 301 redirects from old joomla (mambo) website to new drupal 7 website using .htaccess
问题描述
在过去的几个小时里,我想创建自定义重定向从旧曼波网站,新的Drupal 7的网站与存在于我的Drupal的根目录下的.htaccess文件。 我想要做的是...
The past couple of hours I am trying to create custom redirects from an old mambo website to new drupal 7 website with the .htaccess file that exists in my drupal's root. What I want to do is...
301重定向
的http://mysite.com/index.php?option=com_content&task=blogsection&id=11&Itemid=54
到
http://mysite.com/this-is-the-new-page
这是我的.htaccess文件...
This is my .htaccess file...
RewriteEngine on
RewriteRule ^index.php?option=com_content&task=blogsection&id=11&Itemid=54$ http://mysite.com/this-is-the-new-page [R=301,L]
RewriteRule "(^|/)\." - [F]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
我相信它有事情做这一行...
I am sure that it has something to do with this line...
RewriteRule ^ index.php [L]
不过,我不明白这一点! 你看,如果我用这个...
But I don't get it! You see if I use this...
RewriteRule ^option=com_content&task=blogsection&id=11&Itemid=54$ http://mysite.com/this-is-the-new-page [R=301,L]
而不是此
...
instead of this...
RewriteRule ^index.php?option=com_content&task=blogsection&id=11&Itemid=54$ http://mysite.com/this-is-the-new-page [R=301,L]
和Firefox和LiveHTTP头测试它的插件它的作品!
and test it with firefox and LiveHTTP Headers addon it works!
有什么建议?!
谢谢!
推荐答案
查询字符串不是的 URL路径模式。如果你想立足于查询字符串的规则,你必须在的 的RewriteCond
The query string is not part of the URL path pattern. If you want to base a rule on the query string, you must do so in a RewriteCond
RewriteEngine on
RewriteCond %{QUERY_STRING} option=com_content&task=blogsection&id=11&Itemid=54
RewriteRule ^index.php$ /this-is-the-new-page? [R,L]
这篇关于从旧的Joomla(曼波)的网站使用的.htaccess自定义301重定向到新的Drupal 7网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!