Page 1 of 1

www.site.com/?p=page instead of index.php?p=page

Posted: Wed Aug 04, 2004 7:57 pm
by poverdrive
I've seen a number of sites that have their links like this:
http://www.site.com/?p=page .. normally I was intrigued & would now like to know how to do it too :)

I've always been doing links like somepage.php?var=value ..
If I try opening for example http://localhost/?p=some_test (for testing purposes obviously..) the browser outputs that anoying 403 error page.
Can anyone tell me how that shortening or masking or whatever is done?

Posted: Wed Aug 04, 2004 7:59 pm
by feyd
it has to do (often) with your documentindex settings..

Posted: Wed Aug 04, 2004 8:00 pm
by LiquidPro
I believe if you have an index.php file it will automatically make it able to do that.

Posted: Wed Aug 04, 2004 8:02 pm
by nigma
If you haven't configured index.php to be one of your directory indexes than it wont.

Posted: Wed Aug 04, 2004 8:12 pm
by poverdrive
If you haven't configured index.php to be one of your directory indexes than it wont.
Go on.. keep explaining :)
You see.. I've been kidding around with php for a little more than a month's time.. so I don't know that much. ;)
Or maybe I'm just confused.. what do u mean by configuring index.php as a directory index?
I'd appreciate some help here.. maybe even an example code if anyone could be bothered..?

Thx 4 your replies though.

Posted: Wed Aug 04, 2004 8:18 pm
by LiquidPro
Make an .htaccess file in your directory, and put this in it...

Code: Select all

DirectoryIndex index.php
That should make it so that your index.php file will be called when the directory is accessed... hence allowing you to go... http://www.site.com/?action=whatever

Goodluck

Posted: Wed Aug 04, 2004 8:24 pm
by nigma
If your using apache than the directory index is a directive inside the config file httpd.conf. Directives are basically what settings are called if you use apache. The directory index directive is a setting that tells apache which file(s) should be used by default.

When you use a url like http://www.domain.com/?p=page then you are trying to pass the variable p with the value "page" to the directory index, or the default page which could be blah.php or foo.php. Whereas if you use a url like http://www.domain.com/index.php?p=page than you are explicitly telling the webserver to open the page index.php and pass it the variable p with the value "page"

Here's apaches page on the directory index directive: http://httpd.apache.org/docs-2.0/mod/mo ... ctoryindex

Sorry if that wasn't clear, please tell me if you don't understand.

Posted: Wed Aug 04, 2004 8:40 pm
by poverdrive
that did the trick :)
thx a lot LiquidPro for the code & nigma - thx for explaining the whole thing :)
gee I never expected so many replies in such a short time ;)

Posted: Wed Aug 04, 2004 8:48 pm
by nigma
I've got no life for the next few days so i'll be hanging around here and posting quite a bit.

Posted: Wed Aug 04, 2004 10:14 pm
by LiquidPro
Same here :)

Posted: Wed Aug 04, 2004 10:22 pm
by d3ad1ysp0rk
Next few days.. loser. Try the next few years. ;)

Posted: Wed Aug 04, 2004 11:12 pm
by nigma
welcome aboard liquidpro. hope you enjoy the forums

Posted: Thu Aug 05, 2004 1:19 am
by LiquidPro
Haha, thanks... I appreciate it.

So far, they're great. I'm surprised by the amount of activity on them.