Im trying to do a 301 redirect in my htaccess to redirect oldfile.htm to mydomain.com/new-path but when I hit that old file to check it I am taken to mydomain.com/new-path?q=oldfile.htm How can I get ride of the ?q=oldfile.htm so that it works properly.

This is what I have in my .htaccess
"Redirect 301 /oldfile.htm http://www.mydomain.com/new-path"

Comments

tmj2k7’s picture

I just had the same issue and found an answer:

In the file, you will find the commands:

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

RewriteBase /

Immediately after that code -- and before the Drupal-provided "Rewrite old-style URLs" commands -- add your rewrite rules using the following format:

#custom redirects

RewriteRule ^old/URL/path$ http://yourdomain.com/new/path [R=301,L]

#end custom redirects

The original poster had a leading / on the old/URL/path but that didn't work for me...taking off the slash fixed it.

Got it from here

Worked like a charm.
Modern Jurist: A Site For Lawyers