.htaccess help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

.htaccess help

Post by Pazuzu156 »

I'm using a .htaccess to rewrite paths to make my urls look cleaner. And for the users it will be /members/username but my thing is members.php?uid=username

For the file I'm using:

Code: Select all

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule members/$1 members.php?uid=$1
But i get redirected to my 404 error page. How would I do this?
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: .htaccess help

Post by flying_circus »

Something about it looks wrong, but I cant test it right now.
The first thing I would try would be to replace the first $1 with (.*)
Pazuzu156 wrote:

Code: Select all

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule members/(.*) members.php?uid=$1
Post Reply