我如何重定向一个URL的所有页面,以最顶级的网页?
How can I redirect all pages on a single URL to the most top level page?
例如,如果有人试图进入 www.thisdomain/sample-子页面他们将被重定向到 www.thisdomain
For example, if someone tries to enter www.thisdomain/sample-sub-page they'll be redirected to www.thisdomain
在讨论的领域有许多关于它的Word preSS装置,所以我宁愿没有单独编辑WP的每个实例。我想有一个小htaccess的片段我可以使用?
The domain in question has a number of Wordpress installations on it so I'd rather not have to edit each instance of WP individually. I assume there's a little htaccess snippet I can use?
我需要能够重定向的所有请求都那些链接到实际页面和那些在错误输入
I need to be able to redirect ALL requests both ones that link to actual pages and those that are entered in error.
推荐答案到的httpd.conf 启用了mod_rewrite和.htaccess,然后把这个code在的.htaccess $ DOCUMENT_ROOT 目录下:
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^sample-sub-page/?$ / [L,R=301,NC]更多推荐
重定向所有页面顶级页面
发布评论