Re: RewriteRules

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

 



Jason Pruim wrote:
Hi Everyone,

I know it's not a php question... But I know alot of you use rewrite rules and regular expressions and so I thought maybe you would be able to help me.

The site: HTTP://purl.raoset.com/test112

test112 doesn't exist.. It's driven by the database using this rewrite rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /p.php [L]

Now, on that site I have a few links... right now the likes are in the format of:
HTTP://purl.raoset.com/design.php?purl=test112

What I would like is to have it read:
HTTP://purl.raoset.com/test112/design

completing the total look of the site :)


technically the same code as above should work even if you change you're links.. you see it's just redirecting everything not found to p.php

so in p.php simply add in a
print_r($_SERVER);
exit();
at the top, upload to server then visit /test112/design in you're browser.. check the print_r output and you'll see the request in there, (variables sometimes differ, hence why I'm suggesting you check; you can skip this bit and jump right on to the next paragraph though)

you can then simply:
$request_page_parts = explode('/', $_SERVER['REQUEST_URI');
print_r($request_page_parts);

then use whatever code you want to display the correct page based on the uri requested (as you want)

I know this isn't the approach you expected but it basically hands off all page selection and processing to php, rather than a load of rewrite rules and lots of updating of .htaccess

if you really want the rewrite rules then I'm sure you've had many other accurate replies with examples :)

--
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