views:

72

answers:

1

I would like to redirect all urls from the webpage (what ever what's after the domain name) to a single webpage that will analyse the complete url and will show the good page and information. I know it's possible with Mod_Rewrite and using some PHP function to get the URL but I can't find any good webpage showing the steps and how to do it.

My questions are:

1)Do you have any reference that I can read about it?

2)Do you think it's a good way to do it, I am transforming a website that need to be more Search Engine friendly and require to have nice url formatting?

+5  A: 

Try:

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

That will redirect everything that doesn't exist to index.php.

This is called the Front Controller pattern.

cletus