RewriteRule Not Performing?

Discussion in 'Apache' started by jeffster, May 11, 2011.

  1. #1
    Okay... I have an issue which is driving me crazy. However, I'm sure there's a logical reason for it. I'm not full of knowledge related to advanced DNS settings, not sure if that actually has anything at all to do with it, or advanced Apache settings. So here's my issue...

    I have an A record pointing sd.example.com to the IP address of our server and on that server, which runs cPanel/WHM on CentOS, I have a hosting acct dedicated to sd.example.com (as opposed to having the subdomain redirect to a sub directory on example.com). example.com is not located on the same server.

    Now, from sd.example.com I am running a CI (CodeIgniter) application. I am attempting to bypass index.php in the URL, which I have done countless times... successfully. Easy enough, right?

    I'm using the typical CI method:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|dir1|dir2|favicon\.ico)
    RewriteRule ^(.*)$ /index.php/$1 [L]

    I've also tried
    RewriteRule ^(.*)$ /index.php?/$1 [L],
    RewriteRule ^(.*)$ index.php?/$1 [L] and
    RewriteRule ^(.*)$ index.php/$1 [L]

    Here's the twist

    RewriteRule ^(.*)$ /index.php/$1 [L] <-- This does not silently redirect to /index.php/$1. It only redirects to /index.php. However...

    RewriteRule ^(.*)$ /index.php/$1 [R] <-- This Will literally redirect to /index.php/$1.

    I'm hoping someone here can be of some assistance and I'd be very thankful for it.
     
    jeffster, May 11, 2011 IP