Permalinks on Wordpress EC2

2020-05-16 01:30发布

I have just transferred my blog from my local webserver to Amazon EC2 Free Linux server, Everything seems to be working now except for permalinks, I disabled and re-enabled them and it still breaks.

I've tried running the script

sudo a2enmod rewrite

But it says a2enmod: command not found while logged into my server as ec2-user

Any help would be much appreciated!

Thanks

8条回答
Melony?
2楼-- · 2020-05-16 02:19

Basic: Connecting to Your Linux Instance from Windows Using PuTTY

Step 1: Open PuTTY to login in AWS EC2 console

Step 2: Enter Server Address

enter image description here

Step 3: Browse Auth Private Key in PuTTY

enter image description here

Step 4: Login to AWS through PuTTY (Enter “Login as name” i.e. your AWS ec2 instance name. for above example: ec2-user)

Step 5: Change directory to /etc/httpd/conf ($ cd /etc/httpd/conf)

Step 6: execute sudo vi httpd.conf to update httpd.conf file. (Open httpd.conf file in VI editor)

Update Following

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

To

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

And

# 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 None

To

# 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

Step 7: Save and Exit from VI editor.

To save and exit from VI editor press [Esc] key and type :wq

Step 8: Restart Apache

Type sudo apachectl -k restart

Final Screenshot

enter image description here

查看更多
狗以群分
3楼-- · 2020-05-16 02:21

On AWS my file was in a slightly different location:

sudo nano /etc/httpd/conf/httpd.conf

After changing AllowOverride None to AllowOverride All in both locaitons and restarting with sudo service httpd restart permalink redirects work great!

查看更多
登录 后发表回答