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
    Regular Coder
    Join Date
    Jun 2002
    Location
    Brisbane, Australia
    Posts
    181
    Thanks
    1
    Thanked 0 Times in 0 Posts

    htaccess confusion

    hey everyone ...

    in my .htaccess file, i have the following code:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
    </IfModule>

    which basically stipulates that if someone types the address:
    http://www.example.com/language/en
    it will redirect them to the following address:
    http://www.example.com/index.php/language/en

    This works great! But the problem is, if i have files in the directory which also use this type of methodology, they're not working. For example ...

    If I type the following in:
    http://www.example.com/test.php/language/en
    It attempts to redirect me to the following (which I dont want it to redirect me at all):
    http://www.example.com/index.php/test.php/language/en

    Now, I have told htaccess (using the !-f and !-d operators) that if the file exists, do not redirect - however, it's not liking the rewriting that's occuring because the filename is not an "exact match".

    The script has to be flexible to allow this ...

    Does anyone have any suggestions?
    -mR_eGo
    _______________________
    Programming since
    3 years old.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    How about changing your logic like,
    Code:
    If the request is like /language/.*
     then redirect to the required file.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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