Welcome Guest, Not a member yet? Register   Sign In
mod_rewrite help
#1

[eluser]jakemac[/eluser]
Hi, I have a website with a bunch of static pages, but one section is done with codeigniter. I am trying to make it so I don't have to write index.php when I call the controller in there so:

https://example.com/~macdonj8/trunk/people/

would go to:

https://example.com/~macdonj8/trunk/index.php/people/

I currently have the following .htacess file under the trunk directory (a repository), which is the same folder as the index.php

RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^people(.*)$ index.php/people$1 [L]

So I think this should check for an index.php, and if its not there it will replace the word people with index.php/people, which is what I want. But this isn't working, anything obvious I am doing wrong?
#2

[eluser]demogar[/eluser]
Try with this on your .htacess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Cheers
#3

[eluser]jakemac[/eluser]
Thanks for the reply! However, I am still getting a 404. I only want it to add the index.php if they go to the people controller also, because I have a bunch of static pages(hundreds actually) that I will gradually converting over, but I want them available in the mean time. If I add index.php to all things it will make those stop functioning (I think).
What do these lines do?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#4

[eluser]jakemac[/eluser]
I have solved my issue, but it not relevant to post here, was really stupid(as with all programming errors)!




Theme © iAndrew 2016 - Forum software by © MyBB