View Full Version : Dillema - clean URL without mod-rewrite or multiview

05-11-2009, 07:17 PM
Look at these two URLs (example):
1: http://codingforums.com/newthread.php/new
2: http://codingforums.com/newthread/new

Both #1 and #2 contain this code.

Of course since #2 is a dir, the code is inside a index.php file.

The problem is #1 works and #2, my preferred method, doesn't work.

I've been googling around for a while and found two solutions to this: mod rewrite and multiview, but these require sever config.

I would like to know if there is a way to accomplish this without configuration, just PHP.

05-11-2009, 07:48 PM
there is a way without mod rewrite but you would still need .htaccess file. i'm not sure is it possible to force no extension to be parsed as .php file without tempering with default server settings or using that .htaccess scheme

05-11-2009, 07:53 PM
In #2, "newthead" is an actual folder not a file so I'm NOT looking for a way to mask the PHP extension.

05-11-2009, 08:35 PM
then #2 should be 2: http://codingforums.com/newthread/index.php/new , but the whole point of url rewriting and clean urls is that they are clean, and that they obscure(i think it's proper word) website folder structure and language used to create it.. eg, you can use asp but add .php extension so that eventual hacker tries injecting malicious php code into your ASP script.

in your #2 server looks for "newthread" folder, and then looks for "new" folder inside that "newthread" folder, if settings are default of course it will not work..

you can try this without anything

http://www.example.com/index.php/something/really/cool that will fill your $_SERVER['request_uri'] var, and http://www.example.com/index/something/really/cool will fail, couse server thinks index is folder...

all in all you only need one index file, or anyother name script file, and never ever need to show real folder structure, except when loading images or image-like files