By ow1n on
My first Drupal site is live now, and I'm in the process of adding some redirects to catch 404s coming from old bookmarks. I'm not getting the results I expect from my changes to .htaccess. I put in this:
Redirect permanent /file.html http://www.example.com/file
...but the visitor is redirected to http://www.example.com/file/?q=file.html
This works:
Redirect permanent /file.html http://www.example.com/?q=file
...but that conflicts with the Clean URL convention my visitors will expect. Is there a better method for accomplishing this?
Comments
I am about to launch a new
I am about to launch a new version of a website and I wish to redirect some links. I am using IIS with ISAPI Rewrite 3, but I cannot seem to get the redirects to work. My .htaccess file looks like this:
and it works as expected for clean URL's. But how do I redirect a URL to a different URL? I wish to do this without using the Global Redirect module. I tried adding...
but it does not work. Can anyone help please?
Ok. order matters... and it
Ok. order matters... and it makes sense! FYI for anyone out there pulling their hair out trying to understand .htaccess. The trick is to add the above line before the rewrite rule for the index.php page. Makes sense! So my .htaccess file now looks like this:
Hope this helps anyone - I am sure I will have to look back at this post for reference. BTW, the 301 code means "moved permanently" and 302 means "Moved temporarily (default)"
Thanks! Just what I needed.
Thanks! Just what I needed. Now my non-drupal redirects work again.
Redirect from Main domain to subdomain
I've set this up exactly as suggested:
The first domain is the main domain. The second domain is a subdomain of the first and also set up as multi-hosted under the same drupal core. I'm getting a hybrid answer: The correct return URL with a "?q=" and the old URL after it, causing 404's. I'd be grateful for some suggestions on what I've done wrong.
This:
http://www.grrn.org/beverage/refillables/biblio.html
yields this:
http://refillables.grrn.org/content/bibliography?q=beverage/refillables/biblio.html
when what I need is this:
http://refillables.grrn.org/content/bibliography
I've got hundreds of pages I need to redirect specifically.
I'm also getting the "?q=" behavior for anything going to other domains outside drupal core.
This: http://www.grrn.org/action/
Yields this: http://archive.grrn.org/action/?q=action/
Rather than this: http://archive.grrn.org/action/
^
- nothing interesting in this comment -
What's new and changing in PHP 8.4
Your original post suggested
Your original post suggested the module Path Redirect.
http://drupal.org/project/path_redirect
Thank you.
This suits my needs. I was able to import several hundred redirects to various new subdomains from their original urls in minutes. Thank you.
I'm curious why you removed your original suggestion. It seems to work fine.
^
Oh, sorry. I thought you are looking for a way to redirect URLs with some wildcard patterns. AFAIK Path_redirect can't do this. I'm not sure you mentioned that in original posting so I didn't want to post junk content here :-)
What's new and changing in PHP 8.4