301 redirect behavior in a drupal system

301 redirect behavior in a drupal system - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the 301 redirect behavior in a drupal system error on your web browser. Problem :


I am migrating an older site to a newer one which is using Drupal. As part of this I am trying to setup some 301 redirects to the new pages but I am getting some unexpected behavior. I added the following line to my .htaccess file:



redirect 301 /redirect.html http://www.example.com/newpage


Unfortunately, what happens is that I get taken to:



http://www.example.com/newpage?q=redirect.html


Which of course doesn't load correctly. Any thoughts?


Solution :

So after a bit of searching, I found the answer here. It is similar to danlefree's but slightly diffrent.



<IFModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

# custom redirects

RewriteRule ^redirect.html$ http://www.mysite.com/newpage [R=301,L]

# end custom redirects

...
</IFModule>


This seems to get the job done.



Forget .htaccess. Use the global redirect. It gives you the following:




  1. Checks the current URL for an alias and does a 301 redirect to it if it is not being used.

  2. Checks the current URL for a trailing slash, removes it if present and repeats check 1 with the new request.

  3. Checks access to the URL. If the user does not have access to the path, then no redirects are done. This helps avoid exposing private aliased node's.



It simplifies migration of your website slightly, and probably most important, it makes it simple to look up exactly what is being redirected where. (as there is a user interface for it)



Bonus (imagine clippy popping up here)



You seem to be creating something similar to clean URLs. I think you might be interested in pathauto.



Your other rewrite rules are interfering.



Try the following instead:



RewriteEngine on

RewriteRule ^/redirect.html$ http://www.mysite.com/newpage [L,R=301]

# ... existing rewrites

We used to Path redirect module for that purpose. It can't handle all powerful things that Mod_rewrite can, but it's done a really nice job for us at preserving old URLs.

We hope that this article has helped you resolve the redirects, drupal, error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=