Welcome Guest, Not a member yet? Register   Sign In
failed to remove index.php. lamp on ubuntu 14.04
#1

I am developing a website and trying to remove the notorious index.php but failed.

My OS is ubuntu desktop 14.04. I has installed lamp (apache/2.4.7) and CI successfully.
I put a folder named ciprojects under /var/www/html/.
All my projects are inside the ciprojects folder.
I created mysite1 and  took the application and system folders outside of mysite1 for the sake of security.
I has created .htaccess file inside mysite1 folder and modified the index.php accordingly.

So my files structure is like the below:
  • --/var/www/html/ciprojects/
  •     --application/
  •     --system/
  •     --mysite1/
  •          --index.php
  •          --.htaccess

And inside the .htaccess file is the following code:

--------the below is the code inside .htaccess file ---------------
     RewriteEngine on

     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d

     RewriteRule ^(.*)$ index.php/$1 [L]
--------the above is the code inside .htaccess file ----------------


It works with the index.php.
That means I can access mysite1 via http://localhost/ciprojects/mysite1 successfully.
I also created a new controller named Hello.php.
I can access http://localhost/ciprojects/mysite1/index.php/hello  successfully.

Then I did something more to remove the index.php:

1. sudo a2enmod rewrite
2. sudo service apache2 restart
3. sudo vi /ect/apache2/sites-available/000-default.conf
4. insert below "DocumentRoot /var/www/html" some lines as the following:
    <Directory "/var/www/html">
          AllowOverride All
    </Directory>
5. sudo service apache2 restart.

I then visited http://localhost/ciprojects/mysite1 and http://localhost/ciprojects/mysite1/hello.

I got "500 Internal Server Error" ...

I cannot figure out how to fix the problem, can anyone give me some clue?
Thanks in advance!
Reply


Messages In This Thread
failed to remove index.php. lamp on ubuntu 14.04 - by billzhoudu - 09-22-2015, 01:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB