Is ^ (starts with a carriage) relative to the .htaccess file or relative to the root of the site?

if I have a file .htaccesson my site located inexample.com/folder1/folder2/.htaccess

and I want to write a rule that processes the page in example.com/folder1/folder2/page.php

I need to make a rule like:

RewriteRule ^page\.php$ page/

Or how

RewriteRule ^folder1/folder2/page\.php$ page/

Basically it ^(starts with) relative to the file .htaccessor relative to the root of the site?

+3
source share
1 answer

Depends on your RewriteBase

Thus, c RewriteBase /, ^refers to the web root. In this case you will need^folder1/folder2/page.php

+9
source

All Articles