Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts

    mod_rewrite and regex (bah)

    I'm having some problems with my mod_rewrite rules

    RewriteEngine on
    RewriteRule /news/([0-9]+) /news.php?id=$1

    That works perfectly to how I want.

    I tried adding another rule afterwards to make site.com/username to go to site.com/members.php but all I'm getting is an error 404

    I'm using this

    RewriteEngine on
    RewriteRule /([0-9]+) /news.php?id=$1
    RewriteRule /([A-Za-z0-9]) /members.php

    Any ideas?

    Also, is there a way to check that whatever is entered into the url isn't a directory that exists? for example site.com/images

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    RewriteRule /members/([0-9A-Z]) /members.php

    That works fine, I'll use this instead


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •