Codeigniter URL rewriting .htaccess is not working on CentOS
You need to also specify the locations that can use it. For example, in /etc/httpd/conf/httpd.conf you should see something like:
<Directory "/var/www/html">
...lots of text...
</Directory>
Make sure is has:
<Directory "/var/www/html">
AllowOverride All
</Directory>
Ravi Dhoriya ツ
I like "freedom" in programming that's why I always prefer Linux, where there's no Gates and Windows. I'm passionate about web technologies and working with Linux server related stuffs. Also love to solve complex database queries and SEO of website.
Updated on June 05, 2022Comments
-
Ravi Dhoriya ツ almost 2 years
I've created a .htaccess file in my document root at
/var/www/html/
to rewrite URL of Codeigniter to remove "index.php" from URL of all pages.e.g. Change URL from
http://myhost/index.php/controller/function
to
http://myhost/controller/function`
Here is the code of my `/var/www/html/.htaccess
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]
I've got many suggestions from googling to enable mod-rewrite module, but I can see in my
httpd.conf
its already enabled.LoadModule rewrite_module modules/mod_rewrite.so
This is perfectly working on my local system running on Debian 7 (Apache/2.4.4).
Any help would be appreciated. :)