Jump to content
Sign in to follow this  
Wirenut

301 Redirect

Recommended Posts

Guest

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. 

Share this post


Link to post
Share on other sites

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"

 

Share this post


Link to post
Share on other sites
Guest

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. 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.