trg_dk
asked on
Apache mod_rewrite
I have a page "Index.php"
I'd like the url parameters passed to the script, but I'm not sure how many the user might pass...
url.com/dashboard - should redirect to index.php?action=dashboard
url.com/users/4000 - should redirect to index.php?action=users&dat a=4000
url.com/users/4000/free - should redirect to index.php?action=users&dat a=4000&ext ra=free
Could some one please help me out here ?
Regards,
Mark
I'd like the url parameters passed to the script, but I'm not sure how many the user might pass...
url.com/dashboard - should redirect to index.php?action=dashboard
url.com/users/4000 - should redirect to index.php?action=users&dat
url.com/users/4000/free - should redirect to index.php?action=users&dat
Could some one please help me out here ?
Regards,
Mark
Can you clarify what technologies you are using?
You talk about both Apache mod_rewrite and Microsoft IIS Web Server
You talk about both Apache mod_rewrite and Microsoft IIS Web Server
ASKER
Ohh, sorry wrong category :(
For this I am using Apache mod_rewrite
Sorry for that!
For this I am using Apache mod_rewrite
Sorry for that!
Here you go.
Make sure mod_rewrite is enabled in the httpd.conf and add the following rewrite rules.
RewriteEngine on
#url.com/dashboard - should redirect to index.php?action=dashboard
RewriteRule ^dashboard/?$ index.php?action=dashboard [L]
#url.com/users/4000 - should redirect to index.php?action=users&dat a=4000
RewriteRule ^dashboard/?$ index.php?action=$1&data=$ 2 [L]
#url.com/users/4000/free - should redirect to index.php?action=users&dat a=4000&ext ra=free
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\ .]+)$ index.php?action=$1&data=$ 2&extra=$3 [L]
Cheers,
Hades666
Make sure mod_rewrite is enabled in the httpd.conf and add the following rewrite rules.
RewriteEngine on
#url.com/dashboard - should redirect to index.php?action=dashboard
RewriteRule ^dashboard/?$ index.php?action=dashboard
#url.com/users/4000 - should redirect to index.php?action=users&dat
RewriteRule ^dashboard/?$ index.php?action=$1&data=$
#url.com/users/4000/free - should redirect to index.php?action=users&dat
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\
Cheers,
Hades666
ASKER
Hades666, thanks for your reply. The Dashboard URL was only an exemple, it might as well be users, setup, profile or anything else.
I guess I need it to accept anything, besides a few reserved keywords (images/CSS/js...)
I guess I need it to accept anything, besides a few reserved keywords (images/CSS/js...)
We can make it anything as it is regex but again we need to know what to want to capture.
Provide everything you want to capture and not and we can build a rule up.
Cheers,
Hades666
Provide everything you want to capture and not and we can build a rule up.
Cheers,
Hades666
ASKER
@hades666 thank you
I'd like to exclude images css admin static from the %1 of possible?
Thanks for your reply
I'd like to exclude images css admin static from the %1 of possible?
Thanks for your reply
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your input, solved it using Google ;)
ASKER
Thanks :)