[英]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.