Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-12-22 04:55:09

progre55
Member
Registered: 2006-05-02
Posts: 668

htaccess 301 assistance

Can anyone give me guidance on writing (or placing) the htaccess 301 redirect. I believe this is the code I want to use:

redirect 301 / http://www.you.com/

But before I do trial and error I was hoping someone could tell me where this should be placed. I just want to be careful not to down the current site – ok really goes without saying.

Thanks.

Last edited by progre55 (2009-12-22 04:56:03)

Offline

#2 2009-12-22 06:48:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,250
Website GitHub Mastodon Twitter

Re: htaccess 301 assistance

I normally place the redirects on the top of the htaccess. Not sure if your script is right though as it looks as if it loops on the same page

something like Redirect 301 /index.php http://www.you.com/ might be what you want? Also note that some servers uses case sensitive htaccess commands and server crashes if the command is in the wrong case. In mine, a capitalization is needed.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2009-12-22 22:31:56

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: htaccess 301 assistance

Colak:

Thanks for the reply … I used the following which worked well:

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /relative/web/path/
RewriteCond %{HTTP_HOST} . 
RewriteCond %{HTTP_HOST} !^www\.yourdomainname\.com 
RewriteRule (.*) http://www.yourdomainname/$1 [R=301,L]
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>
#php_value register_globals 0

I thought it may help someone in the future.

Offline

Board footer

Powered by FluxBB