對於以下內容,RewriteRule
的等效物是什麼?RewriteRule Equivalent
Redirect permanent /a.html http://www.example.com/b/
注意a.html
也駐留在同一個域例如www.example.com。
我發現使用Redirect
指令有點麻煩,因爲"destination" URL cannot use a relative path。
對於以下內容,RewriteRule
的等效物是什麼?RewriteRule Equivalent
Redirect permanent /a.html http://www.example.com/b/
注意a.html
也駐留在同一個域例如www.example.com。
我發現使用Redirect
指令有點麻煩,因爲"destination" URL cannot use a relative path。
如果您想要將a.html重定向到相同的域,但是/ b /目錄例如http://www.anydomain.com/a.html到http://www.anydomain.com/b/請將以下內容添加到您的域根目錄中的.htaccess文件中。
RewriteEngine On
RewriteBase/
#reirect a.html to /b/
RewriteRule ^a.html$ b/ [L,R=301]
請注意* a.html *假定位於同一個服務器上,即* http://www.example.com/*。 – moey
但「http:// www.example.com/b/」不是*相對URL? – symcbean
@symcbean:* http:// www.example.com/b/*是一個完全合格的URL。我正在尋找一種使用相對路徑的解決方案,例如'/ B /'。 – moey