I have a one-page wordpress site. It uses pages and posts but is all programatically included in the core template. I don't want users to ever accidentally access a single posts (even though it's unlikely that would ever happen). I would prefer to not have to use a 404 template either so it would be great to redirect EVERY page to the home page. Is this easily done without interfering with the default .htaccess rules?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try using this plugin. It allows redirection of all URLs.
回答2:
Add this line of code to your htaccess file:
redirect 301 / http://www.yoursiteurl.com/
Replace "yoursiteurl" with your actual domain.
回答3:
I ended up using this plugin and redirecting each page manually, thus leaving irrelevant pages to throw a 404 error. It's not what I wanted but in the end it's best practice.