在我将我的WordPress网站从本地服务器移动到远程服务器后,Permalink无法工作


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

我真的很难找到答案。当我把我的WordPress网站从本地主机移到远程服务器时,我的链接不起作用。它表明:

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

我不知道问题出在哪里。我找了很多,但找不到正确的解决方案。我使用html而不是WordPress导航菜单创建了菜单栏。

这是我的.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>

我不知道该怎么改。有人能帮我吗?

正如Akshay所说,您需要刷新您的Permalinks。

要做到这一点。。。

  • 转到Wordpress管理区域中的设置->固定链接
  • 向下滚动并单击"保存更改"(即使您没有更改任何内容(

他们现在应该工作了。

这是一个非常常见的问题!

在这种情况下,通常有助于更改后端的永久链接结构,保存并将其更改回您想要的任何内容。这将使用新的链接结构重写.htaccess。

此外,由于第3行和最后一行(DOT(不同,您的htaccess在最后一行的第二行可能有拼写错误。

RewriteBase /newsite.in/project/

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

您可以执行以下步骤:

  1. 检查您的服务器上是否启用了mod_rewrite。您可以访问此链接
  2. 当你移动服务器时,请确保更新网站URL和主页链接
  3. 从wordpress面板上的"设置"->"永久链接"更新永久链接

此外,我认为你的永久链接格式不正确。这是我的代码

<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>

您在RewriteRule ./newsite.in/project/index.php [L] 上错过了一个.

步骤1

转到设置=>固定链接

在永久链接设置页面

选择文章名称并再次保存。。看看它是否有效。如果不起作用,转到步骤2

步骤2

检查httpd.conf

RewriteEngine on

重写基是你需要检查的重要内容之一。。在下面的站点中,它的根"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>

在这种情况下,如果您的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>

如果不起作用,请转至步骤3

步骤3

检查您的网站文件夹结构。。

要做到这一点,请将以下代码保存到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

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