• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htaccess

#1
Used CI long ago and always had issues with new setups with .htaccess.  Here I am again, such a familiar and unwanted friend.

The route works correctly for the "main" page, showing what I want, but I cannot access any other page on the site.

I am running on Ubuntu 16.04, CodeIgniter 3.1.6, Apache 2.4.18, and php 7.1.10.

Path on server /var/www/html/

/etc/apache2/sites-available/site.conf (I have a /etc/hosts entry for http://www.site.com)
Code:
<VirtualHost *:80>
        ServerName site.com
        ServerAlias www.site.com
        DocumentRoot /var/www/html/di/public

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

.htaccess
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

routes.php
PHP Code:
$route['default_controller'] = 'page/index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE

config.php
PHP Code:
$config['base_url'] = 'http://www.site.com/';

$config['index_page'] = 'index.php';
//$config['index_page'] = '';

$config['uri_protocol']    = 'REQUEST_URI'

I have turned on mod-rewrite and can see it when looking at phpinfo();

Appreciate your time and assistance.
Reply

#2
If you search the forums on this you will find many topics on it, I have no experience with that OS.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

#3
I recently had a similar issue when removing index.php from my development server, turns out I didn't have "AllowOverride" in Apache config.

I'm not saying that this is your issue, but it may be something to look at.

Ray
Reply

#4
(10-05-2017, 02:52 PM)Raymien Wrote: I recently had a similar issue when removing index.php from my development server, turns out I didn't have "AllowOverride" in Apache config.

I'm not saying that this is your issue, but it may be something to look at.

Ray

Sorry I did not reply earlier but I had "AllowOverride" set to No (or none), I had to set it to All.  It worked after that change.

Thank you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.