[BlueOnyx:08722] Rewrite oddity

Colin Jack colin at mainline.co.uk
Tue Oct 4 09:23:01 -05 2011


I would be interested to hear comments on the following. We have a user who was having problems getting his website working. He sent me the following explanation as to what was happening and I wondered whether anybody could shed some light as to why? On a BX 5106 box.

Quote:

"Ok, All pages on the site are generated through a script called page.php, this script needs a query string parameter (called pid) to work out which page on the website to build and show to the user.  All the navigation code in the CMS knows to call each page using the scheme:/page/pageid/some_descriptive_text, this both makes the URLs look a little more friendly and helps with SEO.  There is then the .htaccess file with some rewrite rules which take requests for /page/pageid/some_descriptive_text and convert them into /page.php?pid=pageid, which is all fairly standard stuff.
 
The problem we're having is that before any of the rewrite rules get called and this conversion happens, something (I think possibly at Apache or php.ini level) is catching the /page/ part of the requested URL and converting it straight to /page.php meaning that the rewrite rules are never fired and the capture of the pageid query string parameter within the URL doesn't happen, thus CMS doesn't know what page to retrieve from the database and the site breaks.
 
The reason I think this is server level is because it seems to do it with other pages as well so if we set up a page called /test.php and then call /test/ in the browser, we still get the contents of /test.php even though that's not what we asked for."

He has managed a work around:

" Interestingly, I've just noticed that calling the REQUEST_URI server variable from within PHP returns the originally requested URL ... I have been able to extract the page id from the REQUEST_URI variable if it's not available in the query string, and I have added that code into the main code tree ..."

But I would be interested as to why this is happening in case it rears its head again!

Regards

Colin








More information about the Blueonyx mailing list