Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By batigolix on
I'm moving a website to drupal from another CMS.
In the old CMS the link for a news article was
http://www.example.com/news/news-item/1234
I moved the content to the drupal database preserving the same IDs
In the new Drupal web the articles can be accessed by
http://www.example.com/node/1234
How can I automatically redirect request to /node/1234 ?
I tried adding Redirect to the .htaccess file and I tried a couple of Rewrite instructions there as well (I am not very familiar with this matter). It didn't work.
How can this redirection be done?
Comments
bump-er-di-bump
ooh what a shame,
i have to bump this.
I don;t use htaccess. Why
I don;t use htaccess. Why don't you post what specifically you tried. It may be that someone more experianced with htaccess will see it and respond with corrections.
-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
specific .htaccess line
this is what i add to .htaccess
Redirect /news/news-item/ http://www.example.com/node/
but requests for
http://www.example.com/news/newsitem/1234
now go to
http://www.example.com/node/1234?q=blog/blog-item/1234
i suspect some drupal mechanism is getting in between
all suggestions are highly appreciated
Why not use the pathauto
Why not use the pathauto module instead? It will let you rename http://www.example.com/node/1234
to
http://www.example.com/news/news-item/1234. In other words, exactly the same url as you had before. You can even suffix the path with .htm, .html, .php etc.
Here is another thread about the usefulness of pathauto in a similar situation to yours:
http://drupal.org/node/35569
hombre!
hombre!
works like a charm
i installed pathauto went to http://www.soahr.com/admin/settings/pathauto and put "/news/news-item/[nid]" in the field "Pattern for all story paths:" (all items happened to be "stories")
and it works!
(the thread you refer to wasn't very helpful though)
did i say already that drupal rocks? no? well, it rocks!
Glad to know it solved your
Glad to know it solved your problem.