Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

if I have an .htaccess file on my site located at example.com/folder1/folder2/.htaccess

and I want to write a rule that effects a page at example.com/folder1/folder2/page.php

Would i need to make the rule like:

RewriteRule ^page\.php$ page/

Or as

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

Basically is the ^ (starts with) relative to the .htaccess file or relative to the site root?

like image 880
JD Isaacks Avatar asked Dec 28 '22 20:12

JD Isaacks


1 Answers

Depends on your RewriteBase

So with RewriteBase /, ^ is relative to web root. In which case you would need ^folder1/folder2/page.php

like image 90
Jason McCreary Avatar answered Jan 13 '23 17:01

Jason McCreary