apache - How do I redirect a specific URL pattern when Drupal Clean URLs are on? -
i have drupal 5.23 installation using clean urls apache , mod_rewrite module. using .htaccess
file clean urls functionality following configuration:
<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !=/favicon.ico rewriterule ^(.*)$ index.php?q=$1 [l,qsa] </ifmodule>
i going disabling localization/internationalization plugins on website, going change every single page's url on website http://www.example.com/en/url-to-a-page
http://www.example.com/url-to-a-page
(the /en
portion being stripped out).
i add mod_rewrite rule give http 301 redirect response incoming urls /en
portion in url directed correct page.
i've tried adding following lines .htaccess
file both above , below existing rules, in both cases visiting page /en
results in http 404 not found response:
rewriterule ^en/(.+)$ http://www.example.com/$1 [r=301]
if comment out existing rules, rule works fine. i've tried add condition rule, doesn't appear have effect either:
rewritecond %{request_uri} =/en/*
this came me when writing of custom redirects, , turns out solution add "l" redirect line. give following @ try:
rewriterule ^en/(.+)$ http://www.example.com/$1 [l,r=301]
note "l" near end of line. that, according the apache rewriterule docs, means "stop rewriting process here , don't apply more rewrite rules".
Comments
Post a Comment