Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
htacccess rewriterule
I changed the default textpattern htaccess file a little bit. After moving a site to txp I would like it to redirect some URLs which other websites have bookmarked. (Which doesn’t work at the moment)
At the moment I have the following code:
DirectoryIndex index.php index.html
Options +FollowSymLinks
RewriteEngine On
RewriteOptions MaxRedirects=10
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php
RewriteCond %{REQUEST_URI} /weblog/comments/(.*) [NC]
RewriteRule ^/weblog/comments/(.*)$ /en/weblog/$1 [R=301]
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
php_flag zlib.output_compression On
php_value zlib.output_compression_level 5
<ifModule mod_php4.c>
php_value zlib.output_compression off
</ifModule>
Last edited by dl33 (2009-03-30 12:33:45)
Offline
#2 2009-03-30 14:48:02
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: htacccess rewriterule
I’d just use this (after </ifModule>
):
Redirect 301 /weblog/comments http://yoursite.com/en/weblog
Offline
Re: htacccess rewriterule
I tried something similar to that but it didn’t seem to work.
Redirect 301 /weblog/comments/(.*) http://yoursite.com/en/weblog/$1
Offline
Re: htacccess rewriterule
This worked:
RedirectMatch 301 /weblog/comments/(.*) http://yoursite.com/en/weblog/$1
Last edited by dl33 (2009-03-30 15:00:29)
Offline
#5 2009-03-30 15:56:46
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: htacccess rewriterule
If your intention is to redirect /weblog/comments/whatever to /en/weblog/whatever, my example does exactly that :)
Offline
Re: htacccess rewriterule
@Els: Mmmh, true, it does. And I thought it needs the $1 etc somewhere in it. Thanks for the help.
Offline
Pages: 1