sdfor
sdfor

Reputation: 6448

Help writing an htaccess

I'd like an htaccess file that would redirect all pages to my index.php so that I can then parse the url and handle the rest. I just don't know how to write it.

thanks

Upvotes: 0

Views: 69

Answers (3)

Gabriel
Gabriel

Reputation: 2750

If you Google around, you'll find various way to do it. This the way I do it (same as Zend Framework).

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

Hope it helps.

Upvotes: 2

Eton B.
Eton B.

Reputation: 6291

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Upvotes: 1

Simple example:

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

Upvotes: 1

Related Questions