Wirenut Posted June 18, 2017 Share Posted June 18, 2017 I am just wondering about a 301 redirect. I often saw it done like this: "Redirect 301 /about.htm http://www.website.com/about.php" That works, but so does this: "Redirect 301 /about.htm /about.php" Does it matter how it's done? I am just wondering why I also saw it the first way with the full URL? Link to comment Share on other sites More sharing options...
Guest Posted June 18, 2017 Share Posted June 18, 2017 You really only need to include the full or "Absolute" URL if you're redirecting to a new domain; otherwise, the "Relative" path is assumed on your existing domain. See: https://httpd.apache.org/docs/current/mod/mod_alias.html#Redirect # Redirect to a URL on a different host Redirect "/service" "http://foo2.example.com/service" # Redirect to a URL on the same host Redirect "/one" "/two" I suspect that a lot of folks assume that by including the Absolute URL they're gaining an SEO advantage, but that's not true - Apache, for example automatically adds the Base URL if it's not included. It's for this same reason that it's always better to use relative URL's everywhere on your site rather than Absolute ones - they simply assume the "Base" URL and it's automatically included. Link to comment Share on other sites More sharing options...
Wirenut Posted June 18, 2017 Author Share Posted June 18, 2017 Thanks, that makes sense, but it also brings up another question. Do you need quotes? All of my redirects contain no quotes around the URL. Should I go and put quotes around all of them? Or does it not matter? Redirect 301 /about.htm /about.php or Redirect 301 "/about.htm" "/about.php" Link to comment Share on other sites More sharing options...
Guest Posted June 19, 2017 Share Posted June 19, 2017 Nah, quotes don't matter anymore - so it's up to you. There's no particular advantage either way, so if it's working, I'd just leave it as it is. Link to comment Share on other sites More sharing options...
Wirenut Posted June 20, 2017 Author Share Posted June 20, 2017 Thanks for the help Big Mike. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now