[英]RedirectMatch and hide URL
假設有一個名為me.com
的網頁,我希望/project/index.php
的文件成為主根文件。
/project/index.php
看起來像這樣:
<?php
header('Location: /project/site-one.html');
exit;
?>
.htaccess
看起來像這樣:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RedirectMatch ^/$ /project/index.php [L]
# more rules follow
現在,如果我訪問me.com
我會得到me.com/project/site-one.html
我想要的是,始終只要有/project/site-one.html
或/project/index.php
即可在adressbar中將me.com
顯示為URL。
這怎么可能? 我已經嘗試過RewriteRule並僅傳遞[L]標志,但是我沒有想要的東西。
您可以在根.htaccess(高於project
的級別)中像這樣使用.htaccess:
RewriteEngine On
RewriteRule ^/?$ /project/site-one.html [L]
您應該從index.php
刪除header(...)
函數調用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.