更新 WP 和 .htaccess 中的永久链接杀死了非 WP 子页面
更新:糟糕,意识到我把代码放在了错误的文件夹中。根目录而不是 /blog/
客户端正在运行旧版本的 wordpress,大约 1.7 或 1.8 左右。
博客位于:
site.com/blog/
链接格式如下:
http:// www.site.com/blog/?p=1276
我选择更改格式以根据标题中的关键字添加标题:
http://www.site.com/blog/keyword1-keywords2-...-keywordX/
然后我更新了我的 .htaccess生成此代码后:
#<IfModule mod_rewrite.c>
#RewriteEngine On
#RewriteBase /blog/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /blog/index.php [L]
结果是 site.com 上不在博客文件夹中的子页面无法访问。 (主页可以访问,并且博客在新 URL 下工作得很好,它只是搞乱了网站的其余部分)
任何人都知道为什么这可能会破坏网站的其余部分以及我可以做出的任何更改代码?
更新:糟糕,意识到我把代码放在了错误的文件夹中。根目录不是/blog/
Update: Woops, realized I put the code in the wrong folder. The root not the /blog/
Client is running an old version of wordpress, around 1.7 or 1.8ish.
The Blog is at:
site.com/blog/
The link format was like this:
http://www.site.com/blog/?p=1276
And I had selected to change the format to have titles based on keywords from the title:
http://www.site.com/blog/keyword1-keywords2-...-keywordX/
I then updated my .htaccess with this code generated:
#<IfModule mod_rewrite.c>
#RewriteEngine On
#RewriteBase /blog/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /blog/index.php [L]
The result was that the subpages on the site.com that were not in the blog folder were unreachable. (the main page was reachable, and the blog did work fine with the new URLs, it just messed up the rest of the site)
Anyone have any ideas on why this might have disrupted the rest of the site and any changes I can make to the code?
Update: Woops, realized I put the code in the wrong folder. The root not the /blog/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了类似的问题,我要做的就是转到每个页面并发布(在更新永久链接结构之后),并更新每个页面,以便它将创建一个新的网址。
I've had a similar problem and what I had to do was go to each page and post (after the permalink structured was updated), and update each one so it will create a new url.