Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-31-2012, 04:06 AM   PM User | #1
Jazz914
Regular Coder

 
Join Date: Jul 2009
Posts: 187
Thanks: 16
Thanked 8 Times in 8 Posts
Jazz914 is an unknown quantity at this point
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
Jazz914 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:16 PM.


Advertisement
Log in to turn off these ads.