Enable Pretty Permalinks in Amazon Web Hosting

This is a tutorial on how to enable pretty permalinks in Amazon Web Hosting services. In order to do this you have to enable mod_rewrite in your Apache server. Otherwise you will get a page not found error.

page not found

page not found

After Enabling Mod Rewrite

After Enabling Mod Rewrite

Log Into Amazon via SSH

Fist you want to log into your amazon via ssh. If you log into you aws console you can get the login syntax. You want to change the last part to your IP address. Here is an example, notice I changed everything after the @ symbol to match my elastic ip address.

ssh -i "extra.pem" ubuntu@52.72.50.12
Grab SSH Connection details

Grab SSH Connection details

Create and Edit Htaccess File for WordPress

Navigate to your WordPress files. Make sure that you are logged in as root. To log in as root just type in the following.

Only cool people share!

sudo su

Navigate to your root folder by typing in the following.

cd /

Now navigate to your WordPress files by typing in the following.

 cd /var/www/html/

You should now see a lit of all your WordPress files. Type in the following command to create a htaccess file.

touch .htaccess

Now enter in vim to edit the htacces file.

vim .htaccess

Hit the letter “i” on your keyboard. Now you are ready to paste in the following information.

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

 

Now hit the escape key on your keyboard and type in the following and hit enter.

:wr

This writes the information to your htaccess file.

Editing Apache Config File

Now you will have to edit the Apache config file. Navigate to sites-available by entering the following lines into your terminal.

cd /
cd /etc/apache2/sites-available

You will see a file in there called 000-default.conf. Type in the following to edit this file.

vim 000-default.conf

Navigate to the bottom of the file and insert the following code before the </VirtualHost> closing tag. This is to enable the htaccess file on the server to AllowOverride All.

<Directory /var/www/html/> 
Options Indexes 
FollowSymLinks 
AllowOverride All 
</Directory>

Enable Mod Rewrite

now we have to enable the mod rewrite rule. This will enable the pretty permalinks that we want on our WordPress. Enter the following commands in your terminal.

cd /
sudo a2enmod rewrite

Restart Apache Server

Finally you will have to restart the Apache server for the changes to take effect. Type in the following comment into your terminal.

sudo /etc/init.d/apache2 restart

Congratulations now your pretty permalinks should be enabled in WordPress. 🙂

Enable Pretty Permalinks in Amazon Web Hosting was last modified: March 10th, 2023 by Maximus Mccullough
Summary
Enable Pretty Permalinks in Amazon Web Hosting
Article Name
Enable Pretty Permalinks in Amazon Web Hosting
Description
This is a tutorial on how to enable pretty permalinks in Amazon Web Hosting services. In order to do this you have to enable mod_rewrite in your Apache server. Otherwise you will get a page not found error.
Author
Publisher
A1WEBSITEPRO LLC
Logo
Enable Pretty Permalinks in Amazon Web Hosting

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.