Codeigniter.htaccess

Sorry for my bad english ...

I have the most basic CodeIgniter setting possible and can't make it work ... if I access the URL http://domain.com/index.php?controllerX/method it works fine.

Now I want to have access http://domain.com/method

I configured the default controller on route.php "controllerX" and try to use the following .htaccess:

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

I tried several .htaccess and each time the server just returns 403 errors. Even if my .htaccess contains only the first line of "RewriteEngine on", it shows 403 errors. I tried installing each folder on chmod 777 or 755 for testing, and that would not change anything.

Is there any way to find out which resource gives error 403? Or am I mistaken elsewhere?

Ok, I read somewhere that I need "Options + FollowSymLink" on my htaccess ... so that the server shows me 500 errors :(

EDIT Ok, now its working with the following htaccess:

 Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php) RewriteRule ^(.*)$ /index.php/$1 [L] 
+2
.htaccess codeigniter-url
Apr 2 '11 at 17:20
source share
2 answers

change the .htaccess file as:

in addition to the changes made to the .htaccess file, we also need to check / change the following parameter:

Apache to read .htaccess files located in the / var / www / html directory. You can do this by editing the httpd.conf file:

sudo nano / etc / httpd / conf / httpd.conf

Find the section and change AllowOverride None to

 AllowOverride All <Directory /var/www/html> AllowOverride All </Directory> Save and exit. 

Now restart Apache to make the change:

sudo systemctl restart httpd

the rest it worked for me

0
Feb 21 '18 at 11:49
source share

I think your question is also answered here.

 RewriteEngine On RewriteBase / # Removes trailing slashes (prevents SEO duplicate content issues) RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ $1 [L,R=301] # Enforce www # If you have subdomains, you can add them to # the list using the "|" (OR) regex operator RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC] RewriteRule ^(.*)$ http://www.plugb.com/$1 [L,R=301] RewriteBase / RewriteCond %{HTTP_HOST} !="" RewriteRule ^index.php(/.*)?$ http://%{HTTP_HOST}$1 [R=301] # Checks to see if the user is attempting to access a valid file, # such as an image or css document, if this isn't true it sends the # request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] 
-one
Oct 12 '12 at 10:09
source share



All Articles