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 1 of 1
  1. #1
    Regular Coder
    Join Date
    Jul 2009
    Posts
    187
    Thanks
    16
    Thanked 8 Times in 8 Posts

    This rewrite code is acting wierd?

    Basically I have the following code:
    Code:
    #Add Trailing Slash to all URLS
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !\.[a-zA-Z0-9]+$
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !/$ %{REQUEST_URI}/ [L,QSA,R=301]
    
    #Strip index.php 
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME}/ !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
    With the objective to do 2 things:
    1. If the page request is a URL without a trailing slash add one: http://localhost/parameter/parameter2 becomes http://localhost/parameter/parameter2/
    2. Remove Index.php from the URL


    I am not sure which part of the code is triggering the error but basically it half works:

    http://localhost/folder/secondparameter -> WORKS!

    If there is a single parameter to the URL it seems to fail the redirect, to be exact it redirects to the following URL:
    http://localhost/folder becomes -> http://localhost/E:/Informations/My%...s/base/folder/
    Which is way off the rader and I'm unsure why it is redirecting in this way, as soon as I add a second URL parameter or a trailing slash it works as expected?
    Last edited by Jazz914; 08-31-2012 at 04:14 AM. Reason: Added more information, cleaned the presentation


 

Posting Permissions

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