Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-05-13 17:52:53

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 261
Website Mastodon

Website conversion redirects

I have successfully converted must of my old website to Textpattern – yay! However, I have one webpage that was somewhat popular to link to, and it has moved. How do I create an Apache redirect? I tried

Redirect 301 /alfa/(.*) http://www.skewray.com/articles/1976-alfa-romeo-spider-veloce-ev-conversion

both before and after all of the RewriteEngine stuff:

<IfModule mod_rewrite.c>
	RewriteEngine On
	# map skewray.com to www.skewray.com
	RewriteCond %{HTTP_HOST} ^skewray.com$ [NC]
	RewriteRule ^(.*)$ http://www.skewray.com/$1 [L,R=301]
	# the rest of this is from Textpattern 4.5.2 - don't know what it does
	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]
	RewriteCond %{REQUEST_URI} !=/favicon.ico
	RewriteRule ^(.*) index.php
	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

but I always get redirected to www.www….

Will it make a difference that “alfa” is also an article catagory?

Offline

#2 2013-05-14 08:20:56

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Website conversion redirects

If it’s one web page, why not just redirect the specific page instead of an entire directory. That will at least rule out any conflict between the old URL and the new category.

For example:

redirect 301 /alfa/my-old-page.php http://www.skewray.com/articles/1976-alfa-romeo-spider-veloce-ev-conversion

Offline

#3 2013-05-14 08:28:11

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Website conversion redirects

Also, not that I use it or have tested it, but here’s the rewrite rule from H5BP. Might be worth trying that out if still having problems (slightly different rule than what you have):

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
  RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

Offline

#4 2013-05-14 16:51:59

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 261
Website Mastodon

Re: Website conversion redirects

The directory and various files in it have all been linked to out in the wild. I tried redirecting the entire directory and just the index.html file. Both failed. However, it occurred to me that it may be possible to avoid the arcane Apache redirects and do the redirection in Textpattern.

Offline

#5 2013-05-14 17:34:38

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 261
Website Mastodon

Re: Website conversion redirects

Figured it out – as philwareham said, use a RewriteRule, not a Redirect. The final ApacheBabel was:

RewriteRule alfa/(.*) /articles/1976-alfa-romeo-spider-veloce-ev-conversion [L,R=301]

I used the Monkey-At-Keyboard method to develop this.

Offline

Board footer

Powered by FluxBB