只有默认的永久链接工作 wordpress 其他人成为 404 错误 [英] only default permalinks working wordpress others become 404 error
问题描述
我的问题是在我的 wordpress 网站上,只有默认的永久链接有效.当我更改永久链接时,所有页面都找不到了.只显示主页.
My problem is in my wordpress site only default permalinks is working.. When I change permalinks all pages become not found.. only home page is showing.
当我将永久链接更改为 postname .htaccess 内容更改为
When I change permalinks to postname .htaccess content change to
# 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
# END WordPress
还尝试使用此获取 mod_rewrite 的状态
Also tried to get the status of mod_rewrite using this
in_array( 'mod_rewrite', apache_get_modules())
它返回 1 并且在我的服务器上启用了 mod_rewrite,并且还使用 phpinfo() 进行了检查.mod_rewrite
模块已加载.. 我已经浏览了互联网上所有可用的文档.. 请帮我解决这个问题.. 我的托管服务器是godaddy..
It returns 1 and mod_rewrite is enabled on my server and also checked using phpinfo(). mod_rewrite
module is loaded.. I have gone through all the documents available in internet.. Please help me to solve this problem.. My hosting server is godaddy..
推荐答案
如果您使用的是 Ubuntu,请编辑文件/etc/apache2/apache2.conf(这里有一个/var/www 的示例):>
In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf (here we have an example of /var/www):
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
并将其更改为:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
还要检查您网站的 Apache 配置文件/etc/apache2/sites-available/your_site.conf:
also check Apache configuration file for your website /etc/apache2/sites-available/your_site.conf:
<Directory /var/www/your_site_path/>
AllowOverride None
</Directory>
并将其更改为:
<Directory /var/www/your_site_path/>
AllowOverride All
</Directory>
你需要做 sudo a2enmod rewrite 来启用模块重写
You need to do sudo a2enmod rewrite to enable module rewrite
那么,
sudo 服务 apache2 重启
sudo service apache2 restart
希望对您有所帮助!
这篇关于只有默认的永久链接工作 wordpress 其他人成为 404 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!