Jump to content

Help with Mod_Rewrite and Page Re-write to php quary page


TecTao

Recommended Posts

On a membership site, a user has a code consisting of two capital letters and and series of numbers, such as FL830.

 

There is a php page, website.php that will query the DB and display user information.

 

The page and user information can be access with a GET request www.examplesite.com/webpage.php?rep_id=FL830

 

What I want if for a viewer to only have to type in www.examplesite.com/FL830

 

I have written a mod_rewrite in the .htaccess file in the root of the site.  The following code is

 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).com/([A-Z]+)-([0-9]+)$ (.*).com/webpage.php?rep_id=$1-$2 [L]

The rule being that if someone types in Capitals and numbers after the examplesite.com that it will complete the GET request.

 

This is not working.  If I type in the URL www.examplesite.com/webpage.php?rep_id=FL830 the page comes up with the users information.  If I type in www.examplesite.com/FL830 it errors with a 404 page not found.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.