Forum Moderators: phranque
[edited by: phranque at 10:05 pm (utc) on Apr 15, 2017]
[edit reason] example.com for clarity [/edit]
In htaccess - RewriteRule ^photo/abc/$ http://example.com/photo/xyz/ [R=301,L]The leading / is only used if your RewriteRules are lying loose in the config file--and really, when would you ever do that? A more crucial difference is that RewriteRules in htaccess are typically located in the root folder, so ^ is equivalent to your domain root. If instead they are in the config file, then you need to either put them in a <Directory> section that corresponds precisely to the domain's root, or change all rules to show the appropriate physical filepath.
In httpd.conf - RewriteRule ^/photo/abc/$ http://example.com/photo/xyz/ [R=301,L]
I've heard it might improve performanceMmmwell, yes and no. If you get to the point where you've entirely eliminated htaccess for the whole domain, you will be able to turn off all Overrides settings. This leads to a slight gain in performance, because the server no longer has to go looking for htaccess files along the full path of every request. (The server has no memory. It does not know that it checked two milliseconds ago and found no htaccess. Besides, you might have added between one millisecond and the next; the server has no way of knowing.) Other than that, there's a tiny gain because in htaccess, Regular Expressions are recompiled from scratch every time, while in config they are compiled just once, at server startup. (The server doesn't remember much, but it can flawlessly memorize its own config file.)
old-url-1/I hope this doesn't mean that every single individual URL has its own RewriteRule. If so, you should be looking at a RewriteMap--an option that wasn't available* in htaccess, but can be used in config. Or, in the alternative, rewriting to a php script to handle massive redirects.