Forum Moderators: phranque

Message Too Old, No Replies

Full Path or relative to htaccess?

         

stidj

8:44 pm on Feb 14, 2004 (gmt 0)

10+ Year Member



Hi guys,

When doing a rewrite to a file in same dir as .htaccess do you need to specify the full path?

If you don't use the full path what implications might there be?

jdMorgan

7:17 pm on Feb 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



stidj,

> When doing a rewrite to a file in same dir as .htaccess do you need to specify the full path?

No, it's not required.

> If you don't use the full path what implications might there be?

Remember that the rule can be applied in the current directory, or in any subdirectories of that directory. Therefore, if you don't specify at least a server-relative path, you need to make sure that your pattern only matches in the directory you want it to match in.

I assume here that you are asking about

 RewriteRule ^pattern$ substitution [L] 

versus
 RewriteRule ^pattern$ [b]/[/b]substitution [L] 

If you are asking about

 RewriteRule ^pattern$ [b]/[/b]substitution [L] 

versus
 RewriteRule ^pattern$ [b]http:[i][/i]//www.example.com/[/b]substitution [R=301,L] 

then the answer is that the first form is a substitution of one filename for another internal to the server, and the second is an external redirect. The internal substitution is "invisible" to user-agents, while the redirect requires their cooperation/participation in the redirect.

The first version can be used to "alias" URLs to filenames, while the second version (using a 301 redirect) is used to inform user-agents that they need to update their URL database to use the new URL (if possible).

Jim