简体   繁体   English

WordPress网站重定向固定链接

[英]WordPress site redirect permalinks

I have a word-press site example.com and I am redirecting it to beta.example.com . 我有一个word-press网站example.com ,我将它重定向到beta.example.com

I want my links to be shown as example.com/link1 which was previously shown as beta.example.com/link1 . 我希望我的链接显示为example.com/link1 ,之前显示为beta.example.com/link1 I am getting the page URL with <?php echo get_permalink(id); ?> 我用<?php echo get_permalink(id); ?>获取页面URL <?php echo get_permalink(id); ?> <?php echo get_permalink(id); ?> I tried to change site address and site URL but its not working. <?php echo get_permalink(id); ?>我试图改变网站地址和网站的网址,但它不工作。 I also tried custom permalinks but its not working. 我也试过自定义永久链接,但它不起作用。

This is my first WordPress site I may be doing something wrong but I can not figure out what's going wrong. 这是我的第一个WordPress网站,我可能做错了什么,但我无法弄清楚出了什么问题。

WordPress can also store URLs in the database, in various locations. WordPress还可以在不同位置存储数据库中的URL。 You can manually edit the database in most cases, but some are stored in serialized objects, which cant be (easily) edited by hand, so you can use a find and replace tool such as http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ 在大多数情况下,您可以手动编辑数据库,但有些存储在序列化对象中,无法手动(轻松)编辑,因此您可以使用查找和替换工具,如http://interconnectit.com/products/search -and替换换的WordPress的数据库/

Be very careful to read the instructions with that tool, take a backup beforehand and remove the script from the server when you are done. 请务必仔细阅读该工具的说明,事先进行备份,并在完成后从服务器中删除脚本。

检查您的根目录中的.htaccess文件,查看可能将您的链接重定向到beta.yoursite.com的任何条目

WordPress stores that info in: WordPress将该信息存储在:

example.com/wp-admin/options-general.php example.com/wp-admin/options-general.php

The nice thing about WordPress is even if links in the front-end seem off, the admin area should be working. 关于WordPress的好处是,即使前端的链接似乎关闭,管理区域应该正常工作。 If not, then something is really amiss. 如果没有,那么事情真的很糟糕。 But issues like this are fairly common with WordPress migrations. 但是这样的问题在WordPress迁移中相当普遍。

That said, I prefer to hard-code the install configuration info in the wp-config.php file. 也就是说,我更喜欢在wp-config.php文件中硬编码安装配置信息。 You can add the new URL basepath to your wp-config.php file like so: 您可以将新的URL基路径添加到wp-config.php文件中,如下所示:

define('WP_SITEURL', 'http://example.com');
define('WP_HOME',    'http://example.com');
define('WP_CONTENT_URL', 'http://example.com/wp-content');

I place those near the top of the file just above the database settings. 我把那些靠近文件顶部的那些放在数据库设置的正上方。 I find that doing it this way makes easier to migrate sites from one URL to another. 我发现以这种方式这样做可以更轻松地将站点从一个URL迁移到另一个URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM