Link to home
Start Free TrialLog in
Avatar of ramrocket
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


Avatar of mnb93
mnb93

Do you want:

I goto:

http://myserver.com/customer/xpages.php?pageid=john

and that (serverside) goes to:

http://myserver.com/customer/john

Or the otherway round?
IF you want the latter:


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer(.*)/?$ customer/xpages.php?pageid=$1 [L]
Avatar of ramrocket

ASKER

what does the [L] do?
ASKER CERTIFIED SOLUTION
Avatar of mnb93
mnb93

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What about this solution?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer/xpages.php?pageid=(.*)$ customer/xpages.php?pageid=$1 [L]
change
RewriteRule ^customer/xpages.php?pageid=(.*)$ customer/xpages.php?pageid=$1 [L]
to
RewriteRule ^customer/xpages\.php?pageid=(.*)$ customer/xpages.php?pageid=$1 [L]
RewriteRule ^customer/xpages.php?pageid=(.*)$ 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?
Sorry. I thought i wrote it this

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^customer/(.+)$ customer/xpages.php?pageid=$1 [L]