Index only redirect in .htaccess

software development


I am building a new site and it has your standard features organized into code modules; blog, gallery, etc.

While I’m familiar with regular expressions, I’m having trouble getting the correct .htaccess entry to do what I want.

I want to be able to have the browser load a specific page from one of the modules but only if the REQUEST_URI is blank so the standard index (ie. would be called by default.

For instance:
I was trying
RewriteCond %{REQUEST_URI} ^$
RewriteRule ^(.*)$

I had the (.*) in the RewriteRule because after that I would try to do my standard non-www to www rules.

Any tips?


The first line of an HTTP request includes the absolute path from the URL. As soon as the first line is sent, DreamHost web servers will immediately return “400 Bad Request” if the absolute path was left out. As a result the REQUEST_URI will never be blank - AFAIK.

I think you forgot that the absolute path (and hence the REQUEST_URI value) will always start with a slash.

:cool: -//-