Jump to content

Recommended Posts

Hi guys, I'm having a bit of trouble with my .htaccess file.  I have it setup to funnel everything to index.php, but it is not supposed to do this for requests to files that actually exist (like my css).  However, given that some of my session variable tracking page views jumps by 2-6 every page load, I suspect it is not working properly. 

 

What am I doing wrong?

 

RewriteEngine on

 

# Do not rewrite requests for files and directories that exist

# This means you can still place images, javascript, and css

# in /home/youraccount/yourdomain.com/ directory (or sub-directories)

 

RewriteCond %{REQUEST_FILENAME} -f

# RewriteCond %{REQUEST_FILENAME} -d

RewriteRule .* - [last]

 

# Now rewrite every other request to index.php

 

# Sends: http://www.yourdomain.com => http://www.yourdomain.com?__controller=Index&__action=Index&__params=

RewriteRule ^/?$ index.php?__controller=Index&__action=Index&__params= [QSA,L]

 

# Sends: http://www.yourdomain.com/Members => http://www.yourdomain.com/index.php?__controller=Members&__action=Index&__params=

RewriteRule ^([^/]+)/?$ index.php?__controller=$1&__action=Index&__params= [QSA,L]

 

# Sends: http://www.yourdomain.com/Members/List => http://www.yourdomain.com/index.php?__controller=Members&__action=List&__params=

RewriteRule ^([^/]+)/([^/]+)/?$ index.php?__controller=$1&__action=$2&__params= [QSA,L]

 

# Sends: http://www.yourdomain.com/Members/List/Sort/FirstName/Dir/Asc => http://www.yourdomain.com/index.php?__controller=Members&__action=List&__params=Sort/FirstName/Dir/Asc

RewriteRule ^([^/]+)/([^/]+)/(.*)/?$ index.php?__controller=$1&__action=$2&__params=$3 [QSA,L]

 

This code:

 

RewriteCond %{REQUEST_FILENAME} -f

# RewriteCond %{REQUEST_FILENAME} -d

RewriteRule .* - [last]

 

is intended to tell stop execution of any other rules if the file actually exists, but it doesn't appear to be doing that.

  • 3 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.