url rewrite problem ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

url rewrite problem ??

Post by PHPycho »

hello forums !!

CASE:
I want to have the url
1> http://mysite.com/admin -> admin/index.php?q=admin/login
(Note: if there is no any segment after admin it should be routed to admin/login)
2> http://mysite.com/admin/any -> admin/index.php?q=admin/any

And I performed the following for the url rewriting

Code: Select all

RewriteEngine on
 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin\/(.*)$ admin/index.php?q=admin/$1 [QSA,L]
this is only working for 2> case
i would like to know how to handle for case 1> too ?
Any idea?
Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: url rewrite problem ??

Post by requinix »

For the first one, just make your code handle it. If there wasn't a "q" given then use "admin/login" by default.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: url rewrite problem ??

Post by Benjamin »

Hey PHPycho! How are you doing? Long time no see.
Post Reply