简体   繁体   English

我将WordPress网站从本地服务器移至远程服务器后,永久链接无法正常工作

[英]Permalink is not working after I moved my WordPress site from local to remote server

I was really struggling to find the answer. 我真的很难找到答案。 When I moved my WordPress site from localhost to remote server my links are not working. 当我将WordPress网站从localhost移到远程服务器时,我的链接不起作用。 It showing that: 它显示:

The requested URL /project/investment was not found on this server.

I don't know what is the problem. 我不知道是什么问题。 I searched a lot, but I cant find the correct solution. 我进行了很多搜索,但是找不到正确的解决方案。 I have created the menubar using the html rather than the WordPress nav menu. 我使用html而不是WordPress导航菜单创建了菜单栏。

Here is my .htaccess code 这是我的.htaccess代码

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /newsite.in/project/
RewriteRule^index\.php$-[L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./newsitein/project/index.php [L]
</IfModule>

I don't know how to change it. 我不知道该如何更改。 Can anyone please help me? 谁能帮帮我吗?

You need to flush your Permalinks as Akshay stated. 您需要按照Akshay的说明冲洗永久链接。

To do this... 去做这个...

  • Go to Settings->Permalinks in your Wordpress Admin area 转到“ Wordpress管理”区域中的“设置”->“永久链接”
  • Scroll down and click Save Changes (even if you haven't changed anything). 向下滚动并单击“保存更改”(即使您没有进行任何更改)。

They should now work. 他们现在应该工作了。

It's a very common issue! 这是一个非常常见的问题!

In such circumstances it usually helps to change the permalink structure in the backend, save, and change it back to whatever you'd like. 在这种情况下,通常有助于更改后端的永久链接结构,保存并将其更改回所需的任何位置。 This rewrites the .htaccess with the new link structure. 这将使用新的链接结构重写.htaccess。

Also, there might be a typo in your htaccess on the second last line since line 3 and the second last line are different - the DOT. 另外,由于第三行和倒数第二行不同-DOT,您的htaccess的第二行可能有错字。

RewriteBase /newsite.in/project/

vs

RewriteRule ./newsitein/project/index.php [L]

You can do following steps: 您可以执行以下步骤:

  1. Check if mod_rewrite is enable on your server.You can visit this link 检查您的服务器上是否启用了mod_rewrite。您可以访问此链接
  2. When you moved your server make sure you update siteurl and home link 移动服务器时,请确保更新siteurl和主页链接
  3. Update the permalink from Settings->Permalinks on your wordpress dashboard 从Wordpress仪表板上的设置->永久链接更新永久链接

Also your permalink is not formatted properly i think.Here is my code 我认为您的永久链接格式也不正确。这是我的代码

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /newsite.in/project/
RewriteRule^index\.php$-[L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./newsite.in/project/index.php [L]
</IfModule>

You missed a . 您错过了. on RewriteRule ./newsite.in/project/index.php [L] RewriteRule ./newsite.in/project/index.php [L]

Step 1 第1步

Go to Settings => Permalinks 转到设置=>永久链接

In Permalink Settings page 在“固定链接设置”页面中

select post name and save it again ..and see if it's working. 选择帖子名称,然后再次保存..,然后查看它是否有效。 If not working go to step 2 如果不起作用,请转到步骤2

Step 2 第2步

check httpd.conf 检查httpd.conf

RewriteEngine on

Rewrite base is one of the importent thing that you need to check.. in below site it's root "RewriteBase / " 重写基础是您需要检查的重要内容之一。在以下站点中,其根为“ RewriteBase /”

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

In youe case it should be "RewriteBase /newsite.in/" if your wordpress is located folder is located in newsite.in folder. 在您的情况下,如果您的wordpress位于文件夹位于newsite.in文件夹中,则应为“ RewriteBase /newsite.in/”。

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /newsite.in/
RewriteRule^index\.php$-[L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./newsitein/index.php [L]
</IfModule>

If this is not working , Go to step 3 如果这不起作用,请转到步骤3

Step 3 第三步

check your site folder structure.. 检查您的站点文件夹结构。

to do that save below code to test.php and upload to site's root folder 为此,将以下代码保存到test.php并上传到网站的根文件夹

 <?php phpinfo(); ?> 

browse it like http://sitename.com/test.php
seach "DOCUMENT_ROOT" , it should be display like below..


DOCUMENT_ROOT   /home/apache2/public_html

In this your WordPress folder should be in public_html

reference : http://www.online-ebooks.info/article/wordpress_Permalink_is_not_working_after_migration.html 参考: http : //www.online-ebooks.info/article/wordpress_Permalink_is_not_working_after_migration.html

Finally i resolved my problem by referring this link** http://wordpress.org/support/topic/permalinks-error-please-help?replies=17 ** now my permalink problem got over. 最终,我通过引用此链接**解决了我的问题** http://wordpress.org/support/topic/permalinks-error-please-help?replies=17 **现在我的永久链接问题解决了。 Hope this will help others. 希望这对其他人有帮助。 Thanks for all your responses. 感谢您的所有回复。

暂无
暂无

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

相关问题 Cake PHP:由于浏览器缓存而引起的问题,站点在我的本地系统中正常运行,但是当移至远程服务器时却无法运行 - Cake PHP : Issue due to browser cache, site working properly in my local system, but when moved to remote server its not 将Wordpress网站移至本地服务器,现在仅显示页眉和页脚 - Moved Wordpress site to local server, now only header & footers display Wordpress styles 和管理员在将站点从本地转移到 AWS 后无法工作 - Wordpress styles and admin not working after transferring site from local to AWS 更改永久链接结构后wordpress网站出现问题 - problems with wordpress site after changing permalink structure ISP将我的网站迁移到新服务器后丢失的会话 - Lost sessions after ISP moved my site to new server 将magento从本地移动到服务器后,多个站点无法正常工作 - Multiple site not working after move magento from local to server 为什么我不能从本地linux机器上的远程linux服务器上运行可运行的PHP网站? - Why I'm not able to run the working PHP website from remote linux server on my local linux machine? 将我的网站从一台主机移到另一台主机后,jQuery 丢失 - jQuery missing after I moved my site from one host to another 我的 Laravel 5.5 应用程序在部署后无法在远程服务器 namecheap VPS 上运行,但在使用 WAMP 的本地服务器上运行良好 - My Laravel 5.5 app not working on remote server namecheap VPS after deployment but working fine on local server with WAMP 在Plesk服务器上上传的wordpress网站提供警告和永久链接问题 - wordpress site uploaded on Plesk server gives warning and permalink issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM