The requested URL was not found on this server

I wanted to migrate my WP to AWS instance.
So made WP Migration and imported to it.

When I access URL IT says -
Untitled

I went into setting and did choose the custom post type as it was but not working

@GulshanKumar

You should not change permalink settings as such. Maybe try using same old permalinks settings ( or if not changed ) , just press save settings button without doing anything in “permalinks options”.

It will regenerate the .htaccess file and can solve the issue for you.

1 Like

First off, Enable the rewrite module

a2enmod rewrite
service apache2 restart

Then re-save permalink. It should fix.

If doesn’t see below steps

  • Add a fresh .htaccess file with default rewrite rules
# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Still doesn’t work?

  • Check your virtual host and make sure document path is correct and virtual host is really active.
a2ensite example.com.conf
service apache2 restart

not working!
Any other solution???

tail -f /var/log/apache2/access.log


i had it under mantenance mode for few hours!
removed maintenance mode and clicked two posts !
still shows the same error

Ok I found the solution! Ill update down below! in an hour!

1 Like

I think there is no .htaccess on Apache Server.

So, if you are migrating from a Shared Hosting to LAMP hosting sometimes you might face this problem.
With permalinks.
When you migrate from a specific host to another it is always important to have the same URL structure as the last one.

So, to solve it first you have to give write access to /etc/apache2 where apache config file is saved

Login to your server via Putty & Enter these commands -
sudo chown -R ubuntu /var/www/html
chmod -R 755 /var/www/html
Here ubuntu is the username. You change it as your username is.

Then,

  1. Connect To you server via File Zilla

  2. Navigate to /etc/apache2

  3. Open and edit apache2.config

  4. Navigate where the code says -

     <Directory /var/www/>
     	Options Indexes FollowSymLinks
     	AllowOverride All
     	Require all granted
     </Directory>
    

The above code is how your config file should look like.

Save it.

& then restart apache from putty

sudo systemctl restart apache2

I faced another permission error that can be again solved by -
chown -R www-data:www-data /var/www/ && sudo chmod -R 755 /var/www

1 Like

It is there but hidden. Apache is known for .htaccess file.

  • Normally, in File Manager it would show only after selecting checking show hidden file.

  • In terminal, it would appear with ls -a

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.