Setup like php.net/this?
Moderator: General Moderators
-
FuzzyLogik
- Forum Newbie
- Posts: 18
- Joined: Tue Dec 12, 2006 12:15 am
Setup like php.net/this?
I would like to set up my page to be able to be used like this:
http://www.mysite.com/this
or
http://www.mysite.com/that
(without creating separate folders for each and making an index file )
I am using apache, so if I have to use .htaccess, I can.
http://www.mysite.com/this
or
http://www.mysite.com/that
(without creating separate folders for each and making an index file )
I am using apache, so if I have to use .htaccess, I can.
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Yes, you can do that with .htaccess file.
Code: Select all
DirectoryIndex index.php-
FuzzyLogik
- Forum Newbie
- Posts: 18
- Joined: Tue Dec 12, 2006 12:15 am
Can I get a bit of an explanation?dibyendrah wrote:Yes, you can do that with .htaccess file.Code: Select all
DirectoryIndex index.php
I was going to use:
Code: Select all
RewriteRule ^([A-Za-z]+)$ page.php?page=$1- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
This change the default directory page into the given default page.FuzzyLogik wrote:Can I get a bit of an explanation?dibyendrah wrote:Yes, you can do that with .htaccess file.Code: Select all
DirectoryIndex index.php
I was going to use:
Code: Select all
RewriteRule ^([A-Za-z]+)$ page.php?page=$1
If you want to open mydefaultpage.php when you visit some url suppose :
http://xyz.com/pub/
and you want mydefaultpage.php to be opened rather than index.php. use
Code: Select all
DirectoryIndex mydefaultpage.phpAnd in your case,
Code: Select all
RewriteRule ^([A-Za-z]+)$ page.php?page=$1-
FuzzyLogik
- Forum Newbie
- Posts: 18
- Joined: Tue Dec 12, 2006 12:15 am
I don't think you understand what I am trying to do 
If you go to php.net/mail it goes to a different place than php.net/include
I want to do that with my site...
I figured it out, sorta:
RewriteRule ^([A-Za-z]+)/{[0-9+])$ index.php?word=$1
This works perfectly.
I say mysite.com/word and it goes to mysite.com/index.php?word=word
The problem is, I need multiple selectors for my static links (home/about/contact, etc)
so I tried:
RewriteRule ^home$ index.php?page=home
But the two of them don't play nice together.. the one on top trumps the one on bottom.
Anyone know how to fix this?
Thanks.
If you go to php.net/mail it goes to a different place than php.net/include
I want to do that with my site...
I figured it out, sorta:
RewriteRule ^([A-Za-z]+)/{[0-9+])$ index.php?word=$1
This works perfectly.
I say mysite.com/word and it goes to mysite.com/index.php?word=word
The problem is, I need multiple selectors for my static links (home/about/contact, etc)
so I tried:
RewriteRule ^home$ index.php?page=home
But the two of them don't play nice together.. the one on top trumps the one on bottom.
Anyone know how to fix this?
Thanks.
see http://www.php.net/docs.php
http://www.php.net/docs.php wrote:You can also get more information about php.net URL shortcuts by visiting our URL howto page.
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Okay. I thought you are trying to load different default pages for folders.FuzzyLogik wrote:I don't think you understand what I am trying to do
If you go to php.net/mail it goes to a different place than php.net/include
I want to do that with my site...
I figured it out, sorta:
RewriteRule ^([A-Za-z]+)/{[0-9+])$ index.php?word=$1
This works perfectly.
I say mysite.com/word and it goes to mysite.com/index.php?word=word
The problem is, I need multiple selectors for my static links (home/about/contact, etc)
so I tried:
RewriteRule ^home$ index.php?page=home
But the two of them don't play nice together.. the one on top trumps the one on bottom.
Anyone know how to fix this?
Thanks.
In your URL
http://www.mysite.com/this
I thought "this" was folder rather than file. Sorry for misunderstanding.
So, are you trying to achive somehing like http://www.php.net/urlhowto.php ?