skip to Main Content

I migrated a site built in codeigniter today that was previously working and now that it is on its new server, the site has issues. Specifically, the main page loads with AND without www at the front of the URL. When clicking to other pages, if they do not have ‘www’, I get the following error:

“Not Found: The requested URL /services was not found on this server.”

If I modify the URL to include ‘www’, the page loads.

Reminder: this was working before the migration, so I feel it is a server configuration issue.

Server: CentOS 8

2

Answers


  1. Chosen as BEST ANSWER

    As I guessed, this was a server configuration issue. I'm not entirely sure how the home page was loading, but I needed to add the following to my vhost records.

     <Directory "/path/to/project/root">
       AllowOverride All
       Require all Granted
    </Directory>
    

    *There was also a routing issue at play. I used my hosts file to point the domain to the new server, however, the actual dns for the domain had an entry for www, so when I would type www, it was loading the live site.


  2. I recommend that you include the htaccess file in your project root directory and paste the following code into the htaccess file..

    RewriteEngine on
    RewriteCond $1 !^(index.php|public|.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1
    

    I hope now your project should work fine.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search