可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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
回答1:
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.
回答2:
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
回答3:
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
Step 3: Browse Auth Private Key in PuTTY
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
回答4:
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!
回答5:
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>
回答6:
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
回答7:
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?
回答8:
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.