简体   繁体   English

在wordpress中更改.htaccess文件

[英]changing the .htaccess file in wordpress

I was trying to use permalink feature of WordPress on my localhost so I just made copy the code which was generated by WordPress when I clicked on post name from Common Settings . 我试图在localhost上使用WordPress permalink feature ,因此当我post name from Common Settings单击post name from Common Settings时,我只是复制了generated by WordPress的代码。 I saved that generated code in my localhost where the wordpress index.php file was stored in the name of .htaccess and now when I am going to visit the page, url bar of the browser is showing the full address of the post but the post can not be seen on the browser .Only the 404 Not Found error is comming . 我将生成的代码保存在本地主机中,其中wordpress index.php文件以.htaccess的名称存储,现在当我要访问该页面时, browser is showing the full address of the post网址栏browser is showing the full address of the post但该post can not be seen on the browser 。仅出现404 Not Found error is comming Can someone tell me what is the wrong part here? 有人可以告诉我这里错了什么吗?

You should let wordpress write this file for your localhost server. 您应该让wordpress为您的本地主机服务器写入此文件。

You cannot simply copy .htaccess from another server and expect it will work, you have to modify it to reflect your server conf. 您不能简单地从另一台服务器复制.htaccess并期望它可以正常工作,而必须对其进行修改以反映您的服务器配置。

You should modify RewriteBase and the last RewriteRule , eg for http://localhost/wordpress : 您应该修改RewriteBase和最后一个RewriteRule ,例如对于http://localhost/wordpress

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

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

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