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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation URL Rewrite - but with exceptions

    Hi all. Ok, here is the URL Rewrite I'm using right now:

    RewriteEngine on
    Options +FollowSymlinks
    RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?jvID=$1 [L]

    And of course, this routes any subdirectory to index.php. It was initially set up because affiliates want to access the site like so:

    www.thesite.com/affiliateName/

    the index.php does hit the database and look up the "directory" and handles the data from there.

    Now the client wants to add a blog at www.thesite.com/blog and of course, it's not routing correctly.

    Is there a way I can use conditionals in the URL Rewrite to handle real directories? Apologies in advance - my RegEx skills are horrible.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    You can exclude real files and directories by placing a condition before your rule:
    Code:
    Options +FollowSymlinks
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?jvID=$1 [L]

  • #3
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ahh, thanks VERY much!


  •  

    Posting Permissions

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