Permalinks on WordPress (amazon EC2)

Motivation: in my particular case I moved a WordPress site from Bluehost to amazon’s EC2. Permalinks were not working.
Solution: I had to modify the override option from my httpd service.

  1. Go to /etc/httpd/conf and edit httpd.conf
    1
    2
    3
    4
    
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
  2. Change also AllowOverride if it is set to None.
    1
    2
    3
    4
    5
    
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
        AllowOverride All
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
        AllowOverride All
  3. I you haven’t created it yet, place in the root directory of your wordpress installation a .htaccess file with the following contents:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    # 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
    # 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

Source: this post.

11 thoughts on “Permalinks on WordPress (amazon EC2)

  1. Hi

    I am also having the exact same problem after a server move but I have looked and I can’t find /etc/httpd/conf/ httpd.conf

    In fact the /etc/httpd doesn’t exist only /etc/apache2

    Can you help guide me please? Thanks.

    Steven

    • Hi there!

      Hmmm… it’s been a long time since I did this, but I don’t recall having to create the httpd.conf file (I would say it was already there).

      Do you at least have the /etc/httpd directory?

      Maybe one thing that you could try is to install again the apache server ‘sudo apt-get install apache2’ and see if the directory is created.

      Or even you could just check if you have this conf file in apache2 folder, something like ‘/etc/apache2/conf/’

      Just tell me if it helped, otherwise I’ll think of something different to see if we can solve your problem. Cheers!

  2. Hi guiem!

    Thank you so much for this answer.

    Your solution fixed the problem I was having. The problem was, when I changed my Permalink Settings (Settings -> Permalinks)
    from ‘Default’ to ‘Post Name’, and I then clicked on my Post button and Sample Page button, I got the following errors:

    “Not Found The requested URL /Blog/ was not found on this server.
    “Not Found The requested URL /Sample Page/ was not found on this server.

    I spent several days trying to fix this, until I read your post. Thank you very much!

  3. I was managed to solve it by modify:

    Options Indexes FollowSymLinks
    AllowOverride All
    # none has to be modified to all.
    Require all granted

Leave a Reply

Your email address will not be published. Required fields are marked *

*