SLASH "/" in front of relative urls in RewriteRule: Correct Syntax?
Given:
RewriteCond %{HTTP_HOST} ^website.com$
RewriteRule ^$ /de/home [L]
Question: examine the slash in front of de:
/de/home
de/home
What is the difference here and which is more advisable to use?
There is probably no difference in this context, because you are likely to be in the root directory.
Were you not in the root directory, but in a sub-folder like, say,
example.com/beta
, de/home
could point to
example.com/beta/de/home
The starting slash makes sure the URL starts at the root directory, regardless where you are.
精彩评论