Using mod_rewrite with CodeIgniter on Nearly Free Speech

242 views Asked by At

I'll preface this by pointing out that I'm a massive noob with .htaccess stuff and server related stuff in general.

So I've built a website locally with wamp and I used a .htaccess file that I found from googling around.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my_project_folder_name/

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

I obviously replaced "my_project_folder_name" with the real folder name. This works perfectly on my local server. I decided to upload to site to my Nearly Free Speech server and I have been having some trouble with the mod_rewrite. I have no idea what I'm supposed to replace "my_project_folder_name" with, and I can't get it to work. I tried leaving it blank, and that worked, except for some reason this caused a bug that prevented POST data from being received by my scripts. Well, I'm assuming that's what caused the bug.

Could someone please point me in the right direction?

1

There are 1 answers

1
Rahul On

For help purpose just check.

  1. Check apache setting is rewrite_module setting is correct ?

  2. if your folder name consist of two seperate words such as " XYZ ABC" then try " XYZ_ABC" and do the same with you .htaccess file.

  3. Looking at the file it belongs to codeigniter (PHP FRAMEWORK). So if you are not using it then try to use..

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /my_project_folder_name/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    

Hope your problem will get solved.. :)