Lucian Ilea
Lucian Ilea

Reputation: 137

.htaccess - redirect if page not found

I've spent a lot of time searching for a solution to this. I've tried various scenarious, but to no avail...

I have migrated my blog from WordPress to Drupal. Most of the links are ok, but there are few that aren't.

I would like to redirect all blog pages that are not found to the blog root.

Ex. old (broken) link - www.mydomain.com/blog/my-old-article should redirect to new link - www.mydomain/blog

But if www.mydomain.com/blog/my-old-article exists, then it should be displayed.

Is this possible using .htaccess?

Upvotes: 0

Views: 550

Answers (2)

anubhava
anubhava

Reputation: 785481

You can use this ErrorDocument line at top:

ErrorDocument 404 /

Upvotes: 0

yunzen
yunzen

Reputation: 33439

I think it should be done in Drupal itself. Because the apache webserver does not know about the database entries of your blog articles.

Upvotes: 1

Related Questions