.htaccess multiple redirects |
[eluser]Adam Griffiths[/eluser]
Hey guys, I'm busy re-building my blog and I need some help with .htaccess. Basically I'm using wordpress and need to redirect the following urls: www.programmersvoice.com/articles/ -> www.programmersvoice.com/tag/articles/ www.programmersvoice.com/tutorials/ -> www.programmersvoice.com/tag/tutorials/ I tried it a few ways and none of them worked, so I came here! I already have a .htacces file... Code: <IfModule mod_rewrite.c> Can anybody see what I'm doing wrong? If I go to www.programmersvoice.com/tag/tutorial/ I get the page I'm looking for, but when I just go to www.programmersvoice.com/tutorials/ I get a 404. The same happens for articles. Any ideas?
[eluser]fesweb[/eluser]
You need to put those redirects BEFORE your rewrite stuff. Something like: Code: RedirectMatch ^/articles(.*) http://www.programmersvoice.com/tag/articles$1
[eluser]Adam Griffiths[/eluser]
Thanks for replying but that's not what I'm trying to acheive. The way your version works redirects /tutorials to tag/tutorial - but I really want it to do that without changing the URL. I tried tinkering with the version you gave me but it still just wouldn't work.
[eluser]fesweb[/eluser]
In that case, you should be using routes, shouldn't you? Something like this...? Code: $route['articles'] = "tags/articles";
[eluser]Adam Griffiths[/eluser]
Yes but in this case I'm using wordpress, so there's no way of doing this easily without .htaccess.
[eluser]fesweb[/eluser]
Plus, if you route it that way, I think your code would then need to incorporate the rerouted uri info Code: // this
[eluser]simshaun[/eluser]
Try Code: <IfModule mod_rewrite.c> |
Welcome Guest, Not a member yet? Register Sign In |