Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Help with mod_rewrite
Hi.
I’, in dire need of help with a little mod_rewrite magic in the .htaccess file. I’m using the standard one currently, but need to make some modifications in order to accomplish the following:
Articles using the old url scheme http://hertze.com/article/211/fake-title
need to be concerted to the new scheme http://hertze.com/blog/fake-title
.
I don’t now much about mod_rewrite (or regexp), and honestly have no clue. But I’m sure this is quite simple if you know what you’re doing.
Please help. Anyone?
/Joakim
Offline
Re: Help with mod_rewrite
If the old scheme http://hertze.com/article/211/fake-title
works, you don’t need any mod_rewrite magic!
Just open the txp admin tab, point to preferences. Choose “section/title” as permanent link mode.
After you did that the article with url-title fake-title
saved in section blog
is avaible under http://hertze.com/blog/fake-title
.
Offline
Re: Help with mod_rewrite
If you need the old URI to be smartly redirected to the new ones, there’s a plugin: Redirect Pro.
Offline
Re: Help with mod_rewrite
Bastian wrote:
If the old scheme
http://hertze.com/article/211/fake-title
works, you don’t need any mod_rewrite magic!
Well, actually this didn’t work for me. Since the section “article” no longer exists the old URI scheme breaks. I suppose Redirect Pro v1 would have solved the problem, but it does seem a bit overkill for this simple task. And I would then have missed this learning experience ;-).
I scrapped together a mod_rewrite rule from bits and pieces scattered across the Internet and ended up with a .htaccess file looking like this:
RewriteBase /
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^artikel/([0-9]+)/(([^/]+))?$ blogg/$2 [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php
</IfModule>
This worked for me — at least. Thank you all for your input.
Offline
Pages: 1