Mod_rewrite with no suffix - but wont pass variable

I am using mod rewrite to make a url easier to enter. The idea is to call the file with parameters with the short url. I have a version that allows this url:
http://example.com/members/members.php?uid=00000
to be entered as this url:
http://example.com/members/00000/
but I need a user to be able to enter with and without a trailing slash
http://example.com/members/00000

I can't decide how to add the second rule or combine them. When i remove the slash for the suffix, it errors out to 404. Anyone have a good idea?
RewriteBase /members/
RewriteEngine On
RewriteRule ^([^/]*)/$ members.php?uid=$1 [L]

Open in new window

user_xAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David S.Commented:
Try this:
RewriteBase /members/
RewriteEngine On
RewriteRule ^([^/]*)/?$ members.php?uid=$1 [L]

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
user_xAuthor Commented:
Thanks for the post, it didn't work with either trailng slash or non-trailing slash. Tried the ? mark addtion as a second rule too, no dice.

Thanks,
userx
0
David S.Commented:
Try it without using RewriteBase:
RewriteEngine On
RewriteRule members/([^/]*)/?$ members.php?uid=$1 [L]

Open in new window

0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

user_xAuthor Commented:
Still a no go, sorry. It works with the original rule but not without the trailing slash. With those two suggestions, it does not get the url for the variable.
0
tkutherCommented:
RewriteRule ^(.*)$ members.php?uid=$1 [L,QSA]

That will rewrite 0000/  -> members.php?uid=0000/ - not sure if it hurts.

Btw, for debugging you can enable Rewrite Logging in the the server or virtualhost context.
RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 9
0
user_xAuthor Commented:
I used Kravimir's first suggestion last night but had a mistake in the expression. I ended up using this:

RewriteRule ^([0-9-]+)/?$ members.php?uid=$1 [L]

Thanks Kravimir and thank to everybody that helped.
0
user_xAuthor Commented:
Thanks, that got it after all.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.