I am having trouble updating the URL of my first uploaded website that I made from scratch. I have changed the the URL and have submitted to Google, but when I type in the name 'example' into Google my old website URL (www.example.com/example/) is displayed with the old title and meta tags. However when I type in example.com, which is the new URL, it shows first and it's the correct website with the correct tags and title.

How can I make the old URL http://www.example.com/example to just example.com? I have taken out the www. from the new URL, would that be a problem?

  • 1
    If you haven't already, you'll need to 301 redirect www.example.com to example.com and set your Preferred Domain in Google Webmaster Tools/Search Console.
    – dan
    Commented Aug 8, 2016 at 1:35
  • @dan thanks for the answer! most of the 301 redirect are on new pages to old pages how can I redirect 'www.example.com' to 'example.com'? Commented Aug 8, 2016 at 12:15
  • If you're redirecting the non-www URLs to www URLs, but your preferred URL is the non-www, then you'll need to replace those redirects with one of the examples under Catch all and redirect www to no-www.
    – dan
    Commented Aug 8, 2016 at 21:21

1 Answer 1


If you're using an apache server, you can add this to your .htaccess file:

# Enable Rewrite engine
RewriteEngine On
# Check if we're on the www subdomain
RewriteCond %{HTTP_HOST} ^www\.([^\.]+\.[^\.]+)$
# If the previous condition is true, redirect to non-www
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

The above code will redirect everything to a non-www version of your URL

More info >>

  • Thanks for the answer, having troible implementing the statements. Do I put the www.example.com after the www\.? Commented Aug 8, 2016 at 12:53
  • No. Don't change anything about the code. It's a generic redirect. Commented Aug 9, 2016 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.