[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

mod_rewrite need help

Posted on 2006-04-07
8
Medium Priority
?
283 Views
Last Modified: 2006-11-18
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


0
Comment
Question by:ramrocket
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:mnb93
ID: 16405800
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?
0
 
LVL 5

Expert Comment

by:mnb93
ID: 16405808
IF you want the latter:


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

Author Comment

by:ramrocket
ID: 16405976
what does the [L] do?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 5

Accepted Solution

by:
mnb93 earned 800 total points
ID: 16406156
Lets you drive with your parents....lol (ok maybe that wasn't that funny...)
It means [L] ast rule, so it won't process anymore rules after than one. (for that session...(not ever))
0
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 16406756
What about this solution?

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

Expert Comment

by:Muhammad Wasif
ID: 16406758
change
RewriteRule ^customer/xpages.php?pageid=(.*)$ customer/xpages.php?pageid=$1 [L]
to
RewriteRule ^customer/xpages\.php?pageid=(.*)$ customer/xpages.php?pageid=$1 [L]
0
 
LVL 5

Expert Comment

by:mnb93
ID: 16406779
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?
0
 
LVL 20

Expert Comment

by:Muhammad Wasif
ID: 16406861
Sorry. I thought i wrote it this

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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question