Forum Moderators: phranque

Message Too Old, No Replies

Rewrite root to a different page

Directory index not working

         

roycerus

5:27 am on Mar 3, 2006 (gmt 0)

10+ Year Member



Hi,
I have a textpattern website and I want all posts to remain on the website root but don't want the textpattern index.php to be shown when someone lands on the root of the domain. [mydomain.com...]
I have created and set the directory index with htaccess

DirectoryIndex home.php index.php

But there's one part of htaccess which is not letting this happen:

<IfModule mod_rewrite.c>
RewriteEngine On

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

I am not very familliar with regex or htaccess so I am not sure how to get around this. Can someone help?

Regards,
R

jdMorgan

3:41 pm on Mar 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Change the RewriteRule pattern so that it requires at least one character to match:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

Requests for http://www.example.com/ will no longer match this rule, and so won't be rewritten.

Note also that the change from positive-logic 'OR' to negative-logic 'AND' allowed your first rule to be deleted with no change to function.

Jim