Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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
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/
<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
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
Re: htaccess redirect
brilliant. thanks for the quick and clear response. i always used absolute targets before, but had forgotten they were required.
Offline
Pages: 1