.htaccess URL rewriting problems!

January 27, 2011 at 08:05:22
Specs: Windows 7
I have a problem when trying to re-write

http://eg.com/index.php?page=pages&...

to:

http://eg.com/pages/admin-area/menu...

this is my current re-write :

RewriteRule ^pages/admin-area/(.+)/(.+)-(.+)/$ index.php?page=pages&subpage=admin-area§ion=$1&action=$2&id=$3 [L]

any ideas ?


See More: .htaccess URL rewriting problems!

Report •


#1
January 27, 2011 at 14:47:51
Your regex is too greedy. (.+) matches anything, including /'s, so it never matches (think: [infinity]/[infinity] the / is never there...)

Use this:

RewriteRule ^pages/admin-area/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9]+)/?$ index.php?page=pages&subpage=admin-area§ion=$1&action=$2&id=$3 [L]


Report •

#2
February 1, 2011 at 05:12:24
Sorry fmwrap, but as far as I can gather, the web page is not registering the $_GET array properly, and the URL is working perfect but i am still unable to uset the $action and $id _GET in my PHP code!

Report •

Related Solutions


Ask Question