Page 1 of 1

url rewrite problem ??

Posted: Mon Feb 16, 2009 11:14 am
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

Re: url rewrite problem ??

Posted: Mon Feb 16, 2009 3:55 pm
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.

Re: url rewrite problem ??

Posted: Mon Feb 16, 2009 4:01 pm
by Benjamin
Hey PHPycho! How are you doing? Long time no see.