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/
> 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"
Your webserver has a manual. Read it.
Thanks! It helped me a lot!
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.
[ ... ]
> Eg. http://www.yyyy.com/ will access the file
> http://www.yyyy.com/index.php.
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
[ ... ]
> 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