Re: Ensuring all links go to index.php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Oct 20, 2006, at 4:00 AM, Dave M G wrote:

PHP List,

This problem is a little hard to describe. Please forgive me in advance if it's not clear.

I have set up my .htaccess file to work with my PHP script to create "friendly URLs".

[snip]

I thought it had something to do with setting headers. I want everything to operate through the index.php file in my root directory, so I thought I could do that by putting this at the top of the index.php page:

header("Location: /");

Or:

header("/local/server/www/directory/");

Bottom line is, how do I ensure that all links and user requests through the URL end up going to the index.php in my web site's root directory?

If you want all requests to go through index.php, then the .htaccess file would be something like:

RewriteEngine On
RewriteRule ^whatever/.*$  -  [L]
RewriteRule !\.(gif|jpg|png|css|pdf)$	/server_path/index.php

The second line exempts the directory "whatever" and the third line starts by exempting direct requests for files ending with "gif", "jpg", etc.

Then, index.php would examine $_SERVER["REQUEST_URI"] to map the "friendly" URL to content by including files or redirecting with header().

Is that what you mean?

--
Lowell Allen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux