g1smd

msg:3897298 | 8:47 pm on Apr 21, 2009 (gmt 0) |
Is the URL for a real folder in the server filesystem, or is it a 'virtual' URL that is fed into a rewrite? One way is:
RewriteRule ^somepath$ http://www.example.com/somepath/? [R=301,L] but that may not be the best way at all. Be aware that order of processing may not be what you expect if you have other redirects on your site, and those redirects use Redirect or RedirectMatch in them. Use RewriteRule for all of them.
|
jdbnd

msg:3899479 | 11:22 am on Apr 24, 2009 (gmt 0) |
The URL is a "virtual" URL - http://www.example.com/pretty-sounding-filename-without-extension/ Why do you say that that RewriteRule you offered may not be the best way? I do not use Redirect anywhere. Thanks, Joe
|
jdbnd

msg:3899508 | 11:29 am on Apr 24, 2009 (gmt 0) |
If I use that line above, does "somepath" need the leading slash, or not? /url url Joe
|
g1smd

msg:3899669 | 2:52 pm on Apr 24, 2009 (gmt 0) |
If the code goes in .htaccess then omit the leading slash from the rule pattern. Include it only of the rule is going into the httpd.conf file. You are also almost always better off redirecting to strip trailing slashes from extensionless URLs, rather than adding them
|
jdbnd

msg:3899673 | 2:56 pm on Apr 24, 2009 (gmt 0) |
Why is it preferable to strip slashes? Thanks, Joe
|
g1smd

msg:3899896 | 7:12 pm on Apr 24, 2009 (gmt 0) |
A URL that ends in a trailing slash specifies that it is really a folder on the server. URLs without a trailing slash - when they match a real folder name in the filesystem - are redirected to add that slash back on. An extensionless URL should be just that, ending in nothing (no extension, no dot, and no trailing slash either).
|
|