WordPress 中的永久链接无法在本地主机上运行,​​但在实时服务器上运行良好 [英] permalinks in WordPress not working on localhost but work perfectly on live server

查看:22
本文介绍了WordPress 中的永久链接无法在本地主机上运行,​​但在实时服务器上运行良好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了 WordPress 中的永久链接问题,无法在本地主机上运行,​​但在服务器上完美运行.我也是 wordpress 开发人员,并多次遇到这些问题.你能帮我解决这个问题吗.

I am getting problem of permalink in WordPress not works at localhost but perfectly work at server.I am also word press developer and get these problem many times.Can you please help me to resolve this problem.

谢谢

推荐答案

如果您使用的是 ubuntu 系统,那么您需要为您的设置启用 apache2 mod_rewrite.试试这个命令

If you are using ubuntu system then you need to enable apache2 mod_rewrite for your setup. Try this command

sudo a2enmod rewrite

您将收到如下消息:

Enabling module rewrite.
To activate the new configuration, you need to run:
  service apache2 restart

现在输入这个命令来重启你的 apache 网络服务器.

Now enter this command to restart your apache web-server.

sudo service apache2 restart

这应该可以解决您的问题.如果问题仍然存在,则您需要更改 apache 配置文件 (apache2.conf):

This should solve your problem. If the problem persist then you need to change apache config file (apache2.conf):

$ sudo gedit /etc/apache2/apache2.conf

搜索 模型以获取本地主机根目录路径.Web 服务器根路径可能非常基于您安装的 apache 版本.它可能是 .它主要如下:

Search for <directory> model for your localhost root directory path. Web-server root path may very based on your apache installed version. It might be <Directory /var/www/> or <Directory /var/www/html/>. Its mostly like following:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory> 

AllowOverride None 更改为 AllowOverride All.保存并关闭文件.重启你的 apache 网络服务器

Change AllowOverride None to AllowOverride All. Save and close the file. Restart your apache web-server

sudo service apache2 restart

这篇关于WordPress 中的永久链接无法在本地主机上运行,​​但在实时服务器上运行良好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆