Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-08-13 13:21:20
- business-cards.com
- New Member
- Registered: 2008-08-13
- Posts: 4
301 Redirect.
I am using .htaccess to create a 301 redirect that directs http://www.business-cards.com to http:/business-cards.com/index.php. I need to remove the index.php from the end of the url and cannot figure out how to do so.
Below is what my current .htaccess file looks like.
#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]
RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* – [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
#php_value register_globals 0
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ “http\:\/\/www\.business\-cards\.com” [R=301,L]
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.business-cards.com [NC]
RewriteRule ^([^/]+)/$ http://business-cards.com/$1 [L,R=301]
Any help would be greatly appreciated.
Thanks,
Jeremy
Offline
#2 2008-08-18 13:12:27
- business-cards.com
- New Member
- Registered: 2008-08-13
- Posts: 4
Re: 301 Redirect.
Any help here would be greatly appreciated. The .htaccess file seems to be pretty specific to textpattern as help I have tried to get elsewhere has not worked out.
Thanks again,
Jeremy
Offline
Re: 301 Redirect.
I’m not the worlds greatest .htaccess guru but if I was doing any rewriting like that, I’d do it inside the ‘if’ immediately above these lines:
RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]
RewriteRule ^(.*) index.php
I’ve used this in the past to achieve a similar effect:
RewriteCond %{HTTP_HOST} !^business-cards.com$ [NC]
RewriteRule ^(.*)$ http://business-cards.com/$1 [L,R=301]
Which essentially says “if it ain’t business-cards.com in the HOST, make it so”.
Does that help?
Last edited by Bloke (2008-08-18 13:40:32)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#4 2008-08-18 13:43:11
- business-cards.com
- New Member
- Registered: 2008-08-13
- Posts: 4
Re: 301 Redirect.
Awesome! That worked, thanks for your help!
Offline
Pages: 1