Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about url's

0 views
Skip to first unread message

teho

unread,
Apr 28, 2004, 11:09:16 AM4/28/04
to
Hello,

I am new to PHP and I am wondering how can I set index.php to default url
when accessing my site.
Eg. http://www.yyyy.com/ will access the file
http://www.yyyy.com/index.php.

And how can I get the same file writing only http://www.yyyy.com/index

And generally, can this be done for all files? Eg.
http://www.yyyy.com/pages/house will access
the page http://www.yyyy.com/pages/house.php

- Terje

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

kaptain kernel

unread,
Apr 28, 2004, 11:58:09 AM4/28/04
to
teho wrote:

> Hello,
>
> I am new to PHP and I am wondering how can I set index.php to default url
> when accessing my site.
> Eg. http://www.yyyy.com/ will access the file
> http://www.yyyy.com/index.php.

Edit your apache httpd.conf and add index.php to the DirectoryIndex
statement.

>
> And how can I get the same file writing only http://www.yyyy.com/index
>
> And generally, can this be done for all files? Eg.
> http://www.yyyy.com/pages/house will access
> the page http://www.yyyy.com/pages/house.php

Again , edit your httpd.conf

<Location /house>
ForceType application/x-httpd-php
</Location>

Go to the root of your site and create a file called "house"

touch house
pico house

<?
print "hello from house";
?>

This isn't a redirect - more a case of "if i come across a file called
house, treat it like a php file and execute it"

Tim Van Wassenhove

unread,
Apr 28, 2004, 12:32:30 PM4/28/04
to
In article <opr659pq...@news.Individual.net>, teho wrote:
> Hello,
>
> I am new to PHP and I am wondering how can I set index.php to default url
> when accessing my site.
> Eg. http://www.yyyy.com/ will access the file
> http://www.yyyy.com/index.php.
>
> And how can I get the same file writing only http://www.yyyy.com/index
>
> And generally, can this be done for all files? Eg.
> http://www.yyyy.com/pages/house will access
> the page http://www.yyyy.com/pages/house.php

Your webserver has a manual. Read it.

--
http://home.mysth.be/~timvw

teho

unread,
Apr 28, 2004, 1:44:41 PM4/28/04
to
On Wed, 28 Apr 2004 16:58:09 +0100, kaptain kernel <nos...@nospam.gov>
wrote:

Thanks! It helped me a lot!

teho

unread,
Apr 28, 2004, 1:50:14 PM4/28/04
to

I am impressed by your effort to help new users here. When I get into php
I may give something back to others who are trying to learn php from
scratch.
But I bet you never asks a question here, always reading the manual and is
pissed
because someone actually uses this forum for what is here for:

HELPING USERS TO LEARN AND UNDERSTAND!!!

Justin Koivisto

unread,
Apr 28, 2004, 2:14:13 PM4/28/04
to
teho wrote:
> I am impressed by your effort to help new users here. When I get into php
> I may give something back to others who are trying to learn php from
> scratch.
> But I bet you never asks a question here, always reading the manual and
> is pissed
> because someone actually uses this forum for what is here for:
>
> HELPING USERS TO LEARN AND UNDERSTAND!!!

These kind of posts don't help either. You're best bet is to ignore them
rather than retaliate, I do. ;)

--
Justin Koivisto - sp...@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

John Dunlop

unread,
Apr 28, 2004, 2:58:21 PM4/28/04
to
teho wrote:

[ ... ]

If Apache is your server, DirectoryIndex is your friend.

"Apache module mod_dir",
http://httpd.apache.org/docs/mod/mod_dir.html#directoryindex

> And how can I get the same file writing only http://www.yyyy.com/index

I wouldn't publish that URI, if I were you.

> And generally, can this be done for all files? Eg.
> http://www.yyyy.com/pages/house will access
> the page http://www.yyyy.com/pages/house.php

MultiViews usually. More generally, content negotiation.

"Apache Content Negotiation",
http://httpd.apache.org/docs/content-negotiation.html

What you're proposing is a good idea, in my opinion, because URI
suffixes are pointless and potentially harmful. Congratulations.

--
Jock

John Dunlop

unread,
Apr 28, 2004, 2:58:22 PM4/28/04
to
teho wrote:

[ ... ]

> But I bet you never asks a question here, always reading the manual and is
> pissed because someone actually uses this forum for what is here for:
>
> HELPING USERS TO LEARN AND UNDERSTAND!!!

Really? I thought this was Usenet. Grow some skin. :-)

--
Jock

0 new messages