Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Can't get 301 redirects to work
I’m working on a site where I was hired to do the development, and someone else is doing the SEO. They are setting up some 301 redirects from content on the old site, and can’t get it working. He says it has something to do with Textpattern, and I don’t know enough about .htaccess files to help. Here is the file that isn’t working.
Help please!
#DirectoryIndex index.php index.html
#Options +FollowSymLinks #Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /relative/web/path/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{HTTP_HOST} !^www\.almex\.com
RewriteRule (.*) http://www.almex.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php?
RewriteRule ^index\.php?$ http://www.almex.com/ [R=301,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
Redirect permanent http://www.almex.com/A55755/almex.nsf/660433c1b291a118852568e1004a8399/7c0aa73fa97653d705256dcc004cd66c/$FILE/Frame%20Brochure%20106.pdf http://www.almex.com/pdf/Frame%20Brochure%20106.pdf
#php_value register_globals 0
Offline
#2 2008-12-23 22:25:23
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Can't get 301 redirects to work
Change it like this:
Redirect permanent /A55755/almex.nsf/660433c1b291a118852568e1004a8399/7c0aa73fa97653d705256dcc004cd66c/$FILE/Frame%20Brochure%20106.pdf http://www.almex.com/pdf/Frame%20Brochure%20106.pdf
Offline
Re: Can't get 301 redirects to work
Thanks for the assistance. Unfortunately that didn’t work. Doesn’t redirect at all.
Not sure if this affects anything, but I’m with Dreamhost, and in the Control Panel there is a setting for how you want the www to act. I have it set to “Both http://www.domain.com/ and http://domain.com/ work.”
Offline
#4 2008-12-24 01:08:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Can't get 301 redirects to work
If you want to redirect from www.domain.com/path/to/old-page to www.domain.com/path/to/new-page, it should look like this:
Redirect permanent /path/to/old-page http://www.domain.com/path/to/new-page
I don’t think your setting affects this rule. I’m not sure about the $FILE
in your URL though… it’s possible that you need RedirectMatch instead of Redirect, but then you’ll need someone else to help you with the regular expression…
Offline
Re: Can't get 301 redirects to work
Just a guess: if .../660433c1b291a118852568e1004a8399/7c0aa73fa97653d705256dcc004cd66c/...
is not a permanently reachable address for the file (e.g. they are session variables that change from visit to visit) you’ll need to change your redirect to cope with changing details here.
TXP Builders – finely-crafted code, design and txp
Offline
Pages: 1