.htaccess Drupal 301重定向
我正在Drupal中执行一组301重定向 我在.htaccess文件中使用标准方法:.htaccess Drupal 301重定向,.htaccess,redirect,drupal,http-status-code-301,.htaccess,Redirect,Drupal,Http Status Code 301,我正在Drupal中执行一组301重定向 我在.htaccess文件中使用标准方法: <IfModule mod_rewrite.c> RewriteEngine on Redirect 301 /user/testimonials http://thesitedomain.com/testimonials Redirect 301 /user/contact http://thesitedomain.com/contact </IfModule> 显然,我不擅长ht
<IfModule mod_rewrite.c>
RewriteEngine on
Redirect 301 /user/testimonials http://thesitedomain.com/testimonials
Redirect 301 /user/contact http://thesitedomain.com/contact
</IfModule>
显然,我不擅长htaccess重定向,我根本不是Drupal专家
另外,如果您知道全面的htaccess重写资源,我将非常感谢阅读hat。我无法与drupal交谈,但我知道您不需要将这些重定向包含在标记中,因为它们不使用重写引擎,以下内容就够了:
Redirect 301 /user/testimonials http://thesitedomain.com/testimonials
Redirect 301 /user/contact http://thesitedomain.com/contact
您需要使用mod_rewrite来删除现有的查询字符串:
RewriteEngine On
RewriteRule ^user/testimonials/?$ http://thesitedomain.com/testimonials? [L,NC,R=301]
RewriteRule ^user/contact/?$ http://thesitedomain.com/contact? [L,NC,R=301]
注意尾随?删除现有查询字符串的目标中。两个URL在同一drupal中吗?或者你是从另一个地方搬来的? 我的意思是: /用户/证明 也许您需要为/user/essentials(如/essentials)添加url别名
请参阅drupal 7中的admin下的/admin/config/search/path。使用.htaccess文件不是一种好的做法,因为在某些更新中,您也必须更新.htaccess文件
您可以尝试使用模块来管理重定向。不幸无法正常工作。。。它只会转到同一页:/user/commentials/确保此301规则是root.htaccess中的第一条规则,然后在新浏览器中进行测试。
RewriteEngine On
RewriteRule ^user/testimonials/?$ http://thesitedomain.com/testimonials? [L,NC,R=301]
RewriteRule ^user/contact/?$ http://thesitedomain.com/contact? [L,NC,R=301]