如何从子目录重定向到直接Url?via.Htaccess
我的问题是: 我想从以下位置重定向: domain.com/blog/how-to-stuffs/ 致: domain.com/how-to-stuffs/ 请共享.htaccess代码,以执行此类重定向。谢谢。尝试:如何从子目录重定向到直接Url?via.Htaccess,.htaccess,cpanel,.htaccess,Cpanel,我的问题是: 我想从以下位置重定向: domain.com/blog/how-to-stuffs/ 致: domain.com/how-to-stuffs/ 请共享.htaccess代码,以执行此类重定向。谢谢。尝试: Redirect "/blog/how-to-stuffs/" "/how-to-stuffs/" 或者,仅当上述方法无效时才使用此选项 RewriteEngine On RewriteBase / RewriteCond %{REQUE
Redirect "/blog/how-to-stuffs/" "/how-to-stuffs/"
或者,仅当上述方法无效时才使用此选项
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^\/blog\/how-to-stuffs\/?$
RewriteRule ^ /how-to-stuffs/ [R=302,L]
实际上,我想对大量的URL做同样的处理,就像站点中的所有URL一样,所以我必须为每个URL手动执行此操作?请提供帮助。@RaviSharma,若您想为站点中的所有URL执行此操作,可以一次性完成。如果您想使用大量URL,您应该手动包含所有URL,或者排除您不想重定向的URL
redirect 301/blog/https://example.com/
应该重定向/blog/*
中的所有URL。