Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-13 06:47:27

mwillse
Member
From: brooklyn, ny
Registered: 2006-06-26
Posts: 83
Website

htaccess redirect

I’ve read several posts about using htaccess for redirect etc. But none of them mention where to add the statements among the current content of the root htaccess file. I keep geeting an internal server error.

Take this simple redirect:
<code>redirect /archive.html /archive</code>

Where should I put it?

Here? above the contents?
#DirectoryIndex index.php index.html

#Options +FollowSymLinks

#RewriteBase /relative/web/path/

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L] RewriteRule ^(.*) index.php
</IfModule>

#php_value register_globals 0
Here? below the contents?

<br />
Does I need a “#”?

Or should it be used as is?

Thanks for the help. I promise to soon give back more to these forums…

Offline

#2 2006-09-13 07:10:55

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: htaccess redirect

A pound symbol/hash denotes a comment, so # blah blah will comment out the line (it won’t work).

I place my redirects after the existing rules, but it can go anywhere (as long as its on a new line). From a default install:

<pre><notextile>
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/
&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L] RewriteRule ^(.*) index.php
&lt;/IfModule&gt;
#php_value register_globals 0

redirect 301 /archive.html http://site.com/archive/
</notexitle>
</pre>

  • 301=Content permanently moved
  • /archive.html = thing to be redirected
  • http://site.com/archive/ = Redirection target; should be absolute, http://site.com/archives/

Last edited by deldindesign (2006-09-13 07:16:08)

Offline

#3 2006-09-13 15:16:25

mwillse
Member
From: brooklyn, ny
Registered: 2006-06-26
Posts: 83
Website

Re: htaccess redirect

brilliant. thanks for the quick and clear response. i always used absolute targets before, but had forgotten they were required.

Offline

Board footer

Powered by FluxBB