Reputation: 273
I use Mamp free version. I want to work local. For instance, make links work inside htdocs/site1 as they were in the root. To test I tried this:
Inside htdocs I have 2 folders: site1 and site2
Inside site1 I have 2 files: file1.php and file2.php
Inside site1 I have .htaccess with this:
RewriteBase /site1/
Inside file 1 I have a link to check if I can use absolute link. It does not work:
<a href="/file2.php" >go to file 2</a>
Is RewriteBase a good way to make links work in local?. How to do that?
Upvotes: 0
Views: 453
Reputation: 785038
make links work inside htdocs/site1 as they were in the root
You will just need this single rule in htdocs/.htaccess
(a level above site1
)
RewriteEngine On
RewriteRule ^((?!site1/).*)$ site1/$1 [NC,L]
You don't need .htaccess inside
site1for this, you can remove that
RewriteBase` line.
Upvotes: 1