Let's say there is a webpage called me.com
where I want the file from /project/index.php
to be the main root file.
/project/index.php
looks like this:
<?php
header('Location: /project/site-one.html');
exit;
?>
the .htaccess
looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RedirectMatch ^/$ /project/index.php [L]
# more rules follow
now if I visit me.com
I get me.com/project/site-one.html
What I want is, always if there is /project/site-one.html
or /project/index.php
to just show me.com
in the adressbar as URL.
How is this possible? I've tried with RewriteRule and just passing the [L] flag but nothing does what I want.
You can use .htaccess like this in root .htaccess (a level above project
):
RewriteEngine On
RewriteRule ^/?$ /project/site-one.html [L]
You should remove header(...)
function call from your index.php