服务器迁移后,只有主页有效
-
-
我今天有这个问题! [迁移的WordPress网站–主页作品,所有其他页面/链接失败](http://www.petenetlive.com/KB/Article/0001126)I had this problem today! [Migrated WordPress Site – Homepage Works, All Other Pages/Links Fail](http://www.petenetlive.com/KB/Article/0001126)
- 0
- 2016-01-09
- user187724
-
我遇到了同样的问题,然后通过根据此处的默认值更改.htaccess文件来修复它:https://wordpress.org/support/article/htaccess/I had same issue and then it is fixed by changing .htaccess file according to default values from here https://wordpress.org/support/article/htaccess/
- 0
- 2020-06-23
- Muzaffar Mahmood
-
6 个回答
- 投票数
-
- 2012-04-18
我想您会获得http://您的网站,但没有http://您的网站/任何信息
我有一个类似的问题,当我改变时它起作用了
来自
的
httpd.conf
AllowOverride None
到
AllowOverride All
它使
.htaccess
生效.I guess you get http://yoursite but not http://yoursite/anything
I had a similar problem and it worked when I changed
the
httpd.conf
fromAllowOverride None
to
AllowOverride All
It makes the
.htaccess
take effect.-
这个为我工作.大多数人都忘记了这一点.This one worked for me. Most of the people forget about this.
- 6
- 2014-12-10
- qasimzee
-
这对我也有用,只需要在" apache2.conf"部分中更改服务器文件的位置,就我而言,就是"/var/www"This worked for me too, only had to change it in the section of `apache2.conf` for the location of my server files, `/var/www` in my case
- 1
- 2015-11-17
- sponrad
-
这是我的答案的一部分.我在站点配置中添加了" AllowOverride All",但同时还添加了" Options FollowSymLinks".然后,我可以使用自定义的永久链接,该链接还创建了一个适当的根.htaccess文件.之后,一切正常.This was part of the answer for me. I added ```AllowOverride All``` to the site configuration, but I also added ```Options FollowSymLinks```. I was then able to use custom permalinks, which also created an appropriate root .htaccess file. After that everything worked.
- 1
- 2016-09-12
- boot13
-
并且不要忘记重启apache!" sudo服务apache2重新启动"And don't forget to restart apache! "sudo service apache2 restart"
- 1
- 2017-01-11
- gradosevic
-
有效.确保在conf文件中的位置更改AllowOverride选项.It worked. Make sure you change the AllowOverride option at locations in the conf file.
- 1
- 2017-12-19
- Najeeb
-
在httpd.conf中启用LoadModule rewrite_module libexec/apache2/mod_rewrite.so在Mac中起到了作用.删除#以启用它enabling in httpd.conf LoadModule rewrite_module libexec/apache2/mod_rewrite.so did the trick in mac. remove the # to enable it
- 0
- 2019-07-06
- stefanosn
-
- 2011-04-13
尝试刷新您的mod_rewrite规则:
仪表板->设置->永久链接
保存设置(无需进行任何更改)
Try flushing your mod_rewrite rules:
Dashboard -> Settings -> Permalinks
Save settings (no need to make any changes)
-
实际上,甚至不需要保存.仅通过访问该页面即可刷新规则,并且刷新规则的一部分涉及写入.htaccess.No need to even save, actually. The rules are flushed just by visiting that page, and part of flushing the rules involves writing to .htaccess.
- 8
- 2011-04-13
- John P Bloch
-
我每天都学到新东西... :)I learn something new every day... :)
- 0
- 2011-04-13
- Chip Bennett
-
@john您确定只是页面加载是否需要写入.htaccess?我的印象是仅刷新数据库中的rewrite_rules.@john are you sure that just page loads write to .htaccess if it needs to? I was under the impression that only rewrite_rules in the database are flushed.
- 0
- 2011-04-13
- Ashfame
-
wp-admin/options-permalinks.php调用`flush_rewrite_rules()`,这是`WP_Rewrite ::flush_rules()`的包装,如果`$ hard`是`true`(在该页面上调用时),存在`save_mod_rewrite_rules`函数(定义在`wp-admin/includes/misc.php`中,包含在所有管理页面中),它调用`save_mod_rewrite_rules()`.在此处查看该函数的定义:http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/misc.php#L114wp-admin/options-permalinks.php calls `flush_rewrite_rules()`, a wrapper for `WP_Rewrite::flush_rules()`, which, if `$hard` is `true` (which it is when called on that page) and the function `save_mod_rewrite_rules` exists (defined in `wp-admin/includes/misc.php`, included in all admin pages), it calls `save_mod_rewrite_rules()`. See that function's definition here: http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/misc.php#L114
- 0
- 2011-04-13
- John P Bloch
-
实际上将重写规则写入.htaccess的函数称为`insert_with_markers`(在上面的`save_mod_rewrite_rules()`中使用),定义在以下位置:http://core.trac.wordpress.org/browser/trunk/wp-admin/包括/misc.php#L53The function that actually writes the rewrite rules to .htaccess is called `insert_with_markers` (used in `save_mod_rewrite_rules()` above), defined here: http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/misc.php#L53
- 0
- 2011-04-13
- John P Bloch
-
这为我解决了.This fixed it for me.
- 0
- 2017-04-17
- Ed DeGagne
-
无需打开cPanel.我首先尝试了接受的答案,并且我的共享托管,所以找不到httpd.conf,实时聊天仍在加载中.然后我找到了这个答案,它是最易于使用的解决方案.:DNo need to open the cPanel. I was trying the accepted answer first and mine is shared hosting so couldn't find httpd.conf and live chat is still loading. And then I found this answer which does is the most easy to use solution. :D
- 0
- 2017-08-04
- TheOnlyAnil
-
这解决了我的问题(与操作相同)this solved my issue (the same as the op)
- 0
- 2018-12-06
- arvic.rivera
-
- 2015-11-22
我也遇到过同样的问题.
我做了以下操作以在Ubuntu Server上解决该问题:
-
在/etc/apache2/apache2.conf 中,将/var/www/的 AllowOverride None 修改为AllowOverride All
-
键入以下命令以启用.htaccess的mod_rewrite
sudo a2enmod重写
- 重新启动apache服务器:
sudo服务apache2重新启动
问题解决了!!!
I had faced the same problem.
I did the following to resolve it on an Ubuntu Server:
In /etc/apache2/apache2.conf, edit AllowOverride None for /var/www/ to AllowOverride All
Type in the following command to enable mod_rewrite for .htaccess
sudo a2enmod rewrite
- Restart your apache server:
sudo service apache2 restart
The problem solved!!!
-
谢谢,我无法通过其他任何建议解决此问题,但是" a2enmod rewrite"可以解决问题.Thanks, I couldn't get this fixed with any of the other suggestions, but `a2enmod rewrite` did the trick.
- 0
- 2017-06-23
- Martin McCallion
-
+1提及重写mod.没有意识到默认情况下未启用此功能.+1 For mentioning the rewrite mod. Didn't realize that this wasn't enabled by default.
- 0
- 2017-12-13
- Native Coder
-
绝对需要`sudo a2enmod rewrite`来获得这个功能,谢谢!Definitely needed that `sudo a2enmod rewrite` to get this wokring, thanks!
- 0
- 2018-10-05
- Huskie69
-
谢谢!命令" a2enmod rewrite"对我有用.Thanks! The command `a2enmod rewrite`did the trick for me.
- 1
- 2018-10-17
- Lucas Basquerotto
-
谢谢阿维纳什! 与Lucas一样,a2enmod重写对我也有帮助Thanks Avinash! Same with Lucas, the a2enmod rewrite did the trick for me
- 0
- 2019-11-25
- Jero Dungog
-
- 2011-04-13
原因很可能是未复制
.htaccess
文件的原因.在Mac OS X和某些FTP应用程序中,此文件被视为"隐藏",因为它以.
开头.如果转到管理部分的"设置"->"永久链接"部分,则可以重新生成此文件,但是最好找到以前使用的版本并再次使用(特别是如果使用缓存插件的话).The reason is most likely that the
.htaccess
file wasn't copied over. On Mac OS X, and in some FTP applications, this file is considered "hidden" because it starts with a.
. If you go to the Settings -> Permalinks section in your admin section, you can regenerate this file, but it's probably best to find the version you had previously and use that again (especially if you use a caching plugin). -
- 2015-11-09
在Ubuntu 14.04中- 000-default.conf 文件可在此处找到
/etc/apache2/sites-available
或者,如果您运行多个wp,则虚拟主机设置将是您的配置文件名.例如 domain.conf
您必须将
AllowOverride None
替换为AllowOverride All
希望这会起作用.
In Ubuntu 14.04 - the 000-default.conf file can be found here
/etc/apache2/sites-available
Or if you run multiple wp the virtual host setting would be your config file name. e.g. domain.conf
You have to replace
AllowOverride None
toAllowOverride All
Hope this will work.
-
- 2011-04-13
您获得Web服务器404还是WordPress 404?如果它是Web服务器404,则您很可能没有从旧安装中复制htaccess根文件,或者它没有正确的运行权限.
我的第一个故障排除项目是检查并查看htaccess文件是否在根目录中.如果是这样,它包含的内容.
Do you get a web server 404 or a WordPress 404? If it's a web server 404, you most likely didn't copy the root htaccess file over from the old installation, or it doesn't have correct permissions to run.
My first troubleshooting item would be to check and see if an htaccess file exists in the root. And if so, what it contains.
-
检查了.htaccess文件.它包含与wordpress管理面板的永久链接部分中显示的代码相同的代码.我将权限更改为可写,看不到明显的变化.Checked the .htaccess file. It contains the same code that appeared in the permalink section of the wordpress admin panel. I changed the permissions to writable and can see no apparent changes.
- 0
- 2011-04-13
- mikeyrocks
-
@mikeyrocks嗯...另一种可能性是您的新服务器没有打开mod_rewrite.重要提示:您是否正在获取服务器404(显示"未找到"的纯白页)或WordPress 404(样式与您网站的其余部分相同)?@mikeyrocks Hmm... another possibility is that your new server doesn't have mod_rewrite turned on. Important: are you getting a server 404 (plain white page that says "not found"), or a WordPress 404 (styled like the rest of your site)?
- 3
- 2011-04-13
- MathSmath
我最近将WordPress网站的托管更改为 VPS.net .我已经移动了所有文件并导入了数据库.一切正常,直到我单击了一个链接,并注意到我的所有页面都带回了404(首页除外).
站点URL为 http://inksquared.com