我有一个像这样的网址:
http://skepticalgamer.com/category/slam-the-controller
我想从 URL 中去掉“类别”。所以我想要:
http://skepticalgamer.com/slam-the-controller
就像上面的原始 URL 一样。这是可以用 mod_rewrite 完成的吗?
我有一个像这样的网址:
http://skepticalgamer.com/category/slam-the-controller
我想从 URL 中去掉“类别”。所以我想要:
http://skepticalgamer.com/slam-the-controller
就像上面的原始 URL 一样。这是可以用 mod_rewrite 完成的吗?
是的,您可以使用 mod_rewrite 执行以下操作:
RewriteRule ^slam-the-controller$ category/slam-the-controller
这将采用 URL:
http://skepticalgamer.com/slam-the-controller
并将其重写为:
http://skepticalgamer.com/category/slam-the-controller
使用Wordpress Plugins » WP No Category Base可以轻松删除类别库,无需更改 .htaccess。该插件不会永久更改数据库中的 URL,因此如果您禁用该插件,您将恢复您的类别库,而帖子没有 404。