ramrocket
asked on
mod_rewrite need help
I have this URL:
http://myserver.com/customer/xpages.php?pageid=john
I want it to be rewritten as:
http://myserver.com/customer/john
my .htaccess looks like:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) xpages.php?pageid=$1
this one is almost working but I get "xpages/john" as $pageid
I want to get rid of extra string "xpages/" and only get "john" as $pageid
what am I missing to my .htaccess???
thanks in advance
http://myserver.com/customer/xpages.php?pageid=john
I want it to be rewritten as:
http://myserver.com/customer/john
my .htaccess looks like:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) xpages.php?pageid=$1
this one is almost working but I get "xpages/john" as $pageid
I want to get rid of extra string "xpages/" and only get "john" as $pageid
what am I missing to my .htaccess???
thanks in advance
IF you want the latter:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer(.*)/?$ customer/xpages.php?pageid =$1 [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer(.*)/?$ customer/xpages.php?pageid
ASKER
what does the [L] do?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What about this solution?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer/xpages.php?pagei d=(.*)$ customer/xpages.php?pageid =$1 [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer/xpages.php?pagei
change
RewriteRule ^customer/xpages.php?pagei d=(.*)$ customer/xpages.php?pageid =$1 [L]
to
RewriteRule ^customer/xpages\.php?page id=(.*)$ customer/xpages.php?pageid =$1 [L]
RewriteRule ^customer/xpages.php?pagei
to
RewriteRule ^customer/xpages\.php?page
RewriteRule ^customer/xpages.php?pagei d=(.*)$ customer/xpages.php?pageid =$1 [L]
What are you doing? That would be a waste of CPU. That just rewrites it to what it was?
What are you doing? That would be a waste of CPU. That just rewrites it to what it was?
Sorry. I thought i wrote it this
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer/(.+)$ customer/xpages.php?pageid =$1 [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer/(.+)$ customer/xpages.php?pageid
I goto:
http://myserver.com/customer/xpages.php?pageid=john
and that (serverside) goes to:
http://myserver.com/customer/john
Or the otherway round?