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条回答
虎瘦雄心在
2楼-- · 2020-05-16 01:58

I just had this same issue and, assuming you are using httpd, you will need to go to /etc/httpd/conf then open http.conf by running sudo vi httpd.conf and then change "AllowOverride" to:

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

You may also need to change AllowOverride All here:

# 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

Then you need to restart httpd by running apachectl -k restart. Note, you may need to actually run sudo apachectl -k restart.

Let me know if that helps.

查看更多
甜甜的少女心
3楼-- · 2020-05-16 02:01

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

when i set this on my server, then i got 503 internal server error, any advi please?

查看更多
一夜七次
4楼-- · 2020-05-16 02:02

Your server may not have the AllowOverride directive enabled. If the AllowOverride directive is set to None in your Apache httpd.config file, then .htaccess files are completely ignored.

In this case, the server will not even attempt to read .htaccess files in the filesystem. When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files. Example of enabled AllowOverride directive in httpd.config:

Options FollowSymLinks

AllowOverride All

This link may also be helpful: http://codex.wordpress.org/Using_Permalinks

查看更多
淡お忘
5楼-- · 2020-05-16 02:03

I had to use the AllowOverride All and Options +FollowSymLinks in more than one .conf file (and I also tried a2enmod rewrite while I was at it). But it was the last .conf file that was apparently controlling that directory (the .iso we used resulted in several with the same directory ... and the first one I changed had no effect). But once they ALL had both those settings the system began working.

查看更多
贪生不怕死
6楼-- · 2020-05-16 02:14

For Ubuntu, change the "AllowOverride All" at the following location:

"The additional step I had to take was to edit /etc/apache2/sites-enabled/000-default.

In that file you'll find an AllowOverride setting for /var/www, saying "None".

Change the setting to say: AllowOverride All "

Credit to ljonas @ http://wordpress.org/support/topic/solved-permalinks-working-in-apache2-ubuntu-1010

查看更多
对你真心纯属浪费
7楼-- · 2020-05-16 02:17

There are written and video instructions located here https://a1websitepro.com/enable-pretty-permalinks-amazon-web-hosting/

    <Directory /var/www/html/>
     Options Indexes FollowSymLinks
     AllowOverride All
    </Directory>
查看更多
登录 后发表回答