A common symptom after installing a script: the homepage loads fine, but every other page returns 404 Not Found. The pages exist, so the problem is almost never missing content. It is that the rewrite rules which turn a pretty URL such as /about-us/ into a request for index.php are missing from the .htaccess file.
The fix #
Go to cPanel > File Manager, open the folder where the website lives, right-click .htaccess, choose Edit, and add the block below. If a similar block is already there, replace it rather than adding a second copy.
WordPress and most PHP scripts #
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
If the site is in a subfolder #
For a site installed at yourdomain.com/blog/, the base and the target both need the folder name:
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
WordPress: the one-click alternative #
In WordPress you rarely need to edit the file by hand. Go to Settings > Permalinks and click Save Changes without changing anything. WordPress rewrites the block for you. If the links still fail afterwards, the file is not writable and you will need the manual method above.
Notes #
- If your script uses a different entry file, for example
index.html, changeindex.phpin the last two lines to match. - If you cannot see
.htaccessin File Manager, open Settings in the top right corner and tick Show hidden files. - If it still does not appear, the file does not exist. Create a new file named
.htaccessin that folder. - Make a copy of the file before editing it. A single wrong character in
.htaccesstakes the whole site down with a 500 error, and having the original to paste back saves a support ticket.