Just re-designed a static site in drupal. Google has indexed a number of pages that I am now trying to redirect as 301. But, if I put the following into drupal's .htaccess file, I am getting an internal server errror:

  RewriteRule ^news\.html /news [R=301]
  RewriteRule ^recognition\.html /recognition [R=301]  
  RewriteRule ^overview\.html /about [R=301]
  RewriteRule ^people\.html /about/people [R=301]

Thanks in advance.

Comments

jtjones23’s picture

Use Path Redirect instead - http://drupal.org/project/path_redirect

venkat-rk’s picture

Updated: Unless I am mistaken, path_redirect is for redirecting one drupal path to another path or an external path, not an old html path to a current drupal path.

jtjones23’s picture

Path Redirect can be used to redirect static aliases to a Drupal path. I use it every time I convert a static site.

venkat-rk’s picture

Hmm...that's strange. You're right. I don't know if I was looking at some other module, but I seemed to recollect that the last time I tried it, the 'from' and 'to' paths were both drupal paths. Thanks for the tip.

So, do you enter the news.html in the url redirect field on the node edit form for a page that is now at www/domain.com/news in drupal? And, so on?

jtjones23’s picture

You're talking about two different things. Path Redirect fields are at Site Building > URL Redirects. Add "news.html" to the From field and "news" to the To field.

The Path alias field (from the Drupal Path module) is on the node edit form. That's where you would alais the URL to news instead of node/123.

venkat-rk’s picture

You're talking about two different things. Path Redirect fields are at Site Building > URL Redirects. Add "news.html" to the From field and "news" to the To field.

That's exactly the screen I saw before and it didn't seem to work. But, following your instruction, I was able to add the redirect. The mistake I was making was to enter the full drupal path in the 'To' field. Thanks for the help.

The Path alias field (from the Drupal Path module) is on the node edit form. That's where you would alais the URL to news instead of node/123.

I don't know if this is a new feature of the module, but enabling the module now adds a 'url redirect' setting to every node edit form.

jtjones23’s picture

Not a new feature but I see now how URL redirects can be confusing :)

venkat-rk’s picture

Facing a problem with redirecting a path. The old path is partners.html and the new drupal path is www.domain.com/network/partners.

When I enter 'network/partners' in the 'To' field, the module is reporting it as an invalid path.

dipen chaudhary’s picture

Do you get something like more than 20 redirection error? What is your internal error?
--------------------------------------------------------
Dipen Chaudhary
www.dipenchaudhary.com

--------------------------------------------------------
Dipen Chaudhary
www.qed42.com ( Drupal development services specialize in social networks and other user generated content platforms )
www.dipenchaudhary.com

venkat-rk’s picture

I am getting an Internal Server error 500. I thought it was to do with the permissions of .htaccess, which drupal sets at 644 and has to be changed to add the redirect code, but changing it back to 644 didn't help as long as the redirect code was in the file. As soon as I went back to the default .htaccess that ships with drupal, the problem vanished.

dipen chaudhary’s picture

what does ur apache error log say about that 500 error?
--------------------------------------------------------
Dipen Chaudhary
www.dipenchaudhary.com
www.playdrupal.com

--------------------------------------------------------
Dipen Chaudhary
www.qed42.com ( Drupal development services specialize in social networks and other user generated content platforms )
www.dipenchaudhary.com

venkat-rk’s picture

I didn't check the apache log yet. I got the path redirect module working thanks to jt_jones here.

venkat-rk’s picture

Hello Dipen,

This is what the apache error log says:
RewriteRule: bad flag delimiters

joachim’s picture

Weird.

I have lines like this in one of my sites that work fine:

RewriteRule ^contact.php$ http://www.example.com/contact [R=301,L]

venkat-rk’s picture

Yeah, it's a bit weird. I used a similar method for another static site that was moved to drupal and it worked fine for that site.

venkat-rk’s picture

joachim, where exactly did you place these rewrite rules in drupal's .htaccess file?

joachim’s picture

Just above the big chunk of rewrite "old-style urls".

venkat-rk’s picture

Funny. That's exactly where I put them too and got the internal server error. May be I need to check the apache log as dipen pointed out.

Road Runner’s picture

I too am redoing static site to Drupal. I have used the redirect module to change my old static pages Static-Page.html to static-page

Altered uppercase and removed html and Google Analytics shows similar page views and visitors. These pages are indexed by Google too.

If you're interested http://www.digitalmania-online.com
You will see a combination of old static pages and new drupal pages all visible from a Kludged menu system.

profjk’s picture

Hi,
301 will not convert static pages to Drupal. With that, you are going to get the earlier HTML pages and the old site.

Instead, copy the HTML code and paste it into your Drupal site and set the input format to Full HTML.

Best wishes,
JK

PS: If you are using a contrib module to do the path rederct, please disable clean path.

Should work now.
JK

venkat-rk’s picture

Hmm...I am not sure the redirect is for converting static pages to drupal nor is there any need for copying the HTML code etc.

When search engine bots come crawling, the 301 status tells them that the old page has been permanently moved to the new location. This is what the path redirect module seems to do automatically.

themphill’s picture

I've had good success using this method:

RedirectPermanent /voter/form.htm http://mysite.com/permits-and-forms/elections
RedirectPermanent /voter/maps.html http://mysite.com/maps/voting-districts
profjk’s picture

Hi again,
Nice to here that.

JK