.htaccess 使用htaccess将子目录重定向到URL
我试图将子目录重定向到外部URL,隐藏该URL。我已经使用htaccess将域重定向到一个子目录,我希望保持此重定向显示“blog”子目录URL 我的代码如下:.htaccess 使用htaccess将子目录重定向到URL,.htaccess,mod-rewrite,redirect,.htaccess,Mod Rewrite,Redirect,我试图将子目录重定向到外部URL,隐藏该URL。我已经使用htaccess将域重定向到一个子目录,我希望保持此重定向显示“blog”子目录URL 我的代码如下: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$ RewriteRule ^(/)?$ blog [L] RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC] RewriteRule ^subdirectory/
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ blog [L]
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteRule ^subdirectory/?$ http://othersite.com/subdirectory [L,R=301,NC]
我需要更改什么以仅隐藏第二个重定向的URL
谢谢 如果将请求重定向到外部网站,则无法屏蔽URL。如果我理解你的意图,你需要代理这些请求。看看Apache模块。这将允许您在屏蔽URL的同时将请求从服务器发送到其他服务器-这是在幕后发生的。请注意mod_proxy文档中的警告,因为这有可能被滥用。根据您使用它的方式,您的服务器将成为中介