Get 404 error after migrating from webhost to localhost
Permalink
Hi all,
I am going to re-develop a site and now i have done all the steps on the guide to migrate the site from web server to localhost(apache), now home page and dashboard page are fine, but all other pages get an 404 error, i think it's the url path issue, but i can't find the right solution.
i have checked .htaccess file and the rule is on.
below is my .htaccess file:
# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --
and below is my site.php:
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'xxx');
define('DB_PASSWORD', 'xxx');
define('DB_DATABASE', 'xxx');
define('BASE_URL', 'http://localhost');
define('DIR_REL','/the file name which is under htdocs where c5 installed');
define('PASSWORD_SALT', '5LYklG8QeEMx8gbyS9CG3LTByJBhETt0vIbvpwOgjciNz21U98I4oqZlEp3vD1ai');
I am going to re-develop a site and now i have done all the steps on the guide to migrate the site from web server to localhost(apache), now home page and dashboard page are fine, but all other pages get an 404 error, i think it's the url path issue, but i can't find the right solution.
i have checked .htaccess file and the rule is on.
below is my .htaccess file:
# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --
and below is my site.php:
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'xxx');
define('DB_PASSWORD', 'xxx');
define('DB_DATABASE', 'xxx');
define('BASE_URL', 'http://localhost');
define('DIR_REL','/the file name which is under htdocs where c5 installed');
define('PASSWORD_SALT', '5LYklG8QeEMx8gbyS9CG3LTByJBhETt0vIbvpwOgjciNz21U98I4oqZlEp3vD1ai');
Here are the rewrite rules I usually use for my localhost sites:
Where the site is in the subdirectory '/cms/development5621/' of my web root.
An .htaccess expert could probably improve on the above!
RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /cms/development5621/index.php/$1 [L]
Where the site is in the subdirectory '/cms/development5621/' of my web root.
An .htaccess expert could probably improve on the above!
a) edit the code out of htaccess
b) delete a line of the Config table in the database
While in the database, you can also delete the entries in Config that enable caching (which would be my next suggestion if the above does not improve things).
You can probably also remove DIR_REL from config/site as c5 will detect that automatically.