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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.