not able to 301 redirect url in drupal
i am trying to redirect an url from location a to b using .htaccess with the following code
RewriteRule ^accessibility$ http://example.com/topic/accessibility/ [R=301,L]
it is not working
i have this turned on
RewriteCond %{HTTP_HOST} ^www\.(.+)开发者_如何学运维$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
I think you're right: that won't work. Use the Path redirect module instead. Here is an excerpt from its project page:
... allows you to specify a redirect from one path to another path or an external URL, using any HTTP redirect status.
Try:
RewriteCond %{REQUEST_URI} ^/accessibility$ [NC]
RewriteRule ^(.*)$ http://example.com/topic/$1 [L,R=301]
BTW, mod_rewrite
related questions are better asked on serverfault.com, so don't be surprised if a moderator migrates this question over there.
精彩评论