Hi All, I am in need of an .htaccess expert to fix a small bug on a redirect we have. Basically, a simple url to url redirect is affected by another line in the htaccess file. I was going to post this up as a help topic but we find that we need htaccess work quite often so it would be good to find a real expert in this field for future work. Please only reply if you are VERY confident with .htaccess. Regards, DS
Ok, here is the problem: We have a example.co.uk site and a example.com site. Both are Drupal based. The htaccess file is on the .co.uk We want to redirect http://www.example.co.uk/this-url.htm to http://www.example.com/this-url (NOTE: Not the whole site, just this url and note the .htm on the source and no .htm on the destination) So we have in the htaccess: Redirect 301 /this-url.htm http://www.example.com/this-url This should work fine, but its producing the following url: http://www.example.com/this-url?q=this-url.htm The reason is because of the last line in this htaccess block: # Rewrite URLs of the form 'x' to the form 'index.php?q=x'. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] We cannot comment that line out as it is needed by Drupal. We are not able to provide FTP access (hence needing someone good at htaccess) but I am more than happy to send you the actual htaccess file for you to fix and us to upload. Anyone able to help?
Can you paste the rewrite base part. I think the answer could be here https://drupal.org/node/38960 You may simply need to process that rule first but I typically have to fiddle with things a bit so its a bit of trial and error. #custom redirects RewriteRule ^old/URL/path$ http://example.com/new/path [R=301,L] #end custom redirects N.
Assuming this still isn't working for you, what Nigel mentioned is correct. Your current .htaccess is appending the query string because it does not stop parsing after your redirect. So you could do something like: RewriteEngine On RewriteRule ^this\-url.htm$ http://www.example.com/this-url [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] Code (markup): Which should work.