简体   繁体   English

在Wordpress中重写index.php

[英]Rewrite index.php in Wordpress

I started a blog and when I changed my permalink structure to /%postname%/ I get a Page Not Found error. 我开了一个博客,当我将永久链接结构更改为/%postname%/出现“找不到页面”错误。 I want my url to look like this: 我希望我的网址看起来像这样:

http://bobbybeckner.com/sharepoint-list-and-linq-using-jquery-and-ihttphandler/ http://bobbybeckner.com/sharepoint-list-and-linq-using-jquery-and-ihttphandler/

not this: 不是这个:

http://bobbybeckner.com/index.php/sharepoint-list-and-linq-using-jquery-and-ihttphandler/ http://bobbybeckner.com/index.php/sharepoint-list-and-linq-using-jquery-and-ihttphandler/

I read a few posts about changing .htaccess but found no clear solution. 我读了一些有关更改.htaccess的帖子,但找不到明确的解决方案。 Any code examples welcome or recommendations on wordpress plug-ins would be greatly appreciated. WordPress的插件的任何代码示例欢迎或建议将不胜感激。

Update I thought it would be important to mention that my host is running IIS7 but does not allow users to touch it. 更新我认为提到主机运行IIS7但不允许用户触摸它很重要。 In addition, I'm uncertain of any restrictions on the .htaccess file or any other configuration limitations. 另外,我不确定对.htaccess文件有任何限制或任何其他配置限制。

.htaccess files only apply to Apache (well, maybe some other servers use it too, but not IIS). .htaccess文件仅适用于Apache(好吧,也许其他一些服务器也使用它,但IIS不适用)。 AFAIK URL rewriting for IIS is possible, but not as easy. 可以对IIS进行AFAIK URL重写,但并非如此简单。

ISAPIRewrite appears to be a commercial application that does this, but of course, you'd need to get it installed on your server. ISAPIRewrite似乎是执行此操作的商业应用程序,但是,当然,您需要将其安装在服务器上。

Personally, I wouldn't lose any sleep over having /index.php/ in your urls. 就个人而言,我不会因为在您的网址中/index.php/而失去任何睡眠。

Generally when you fill out the structure, if the .htaccess file is writable it will apply the rewrite for you, and if it isn't it will show what the contents should be at the very bottom of the page. 通常,当您填写结构时,如果.htaccess文件可写,它将为您应用重写,否则,它将在页面的最底部显示内容。 Did you check the bottom of the page if it is not writable? 您是否检查了页面底部是否不可写?

You do NOT have to code this yourself. 您不必自己编写代码。

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

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