1

I have updated a site and some of the old links are no longer referring to the right place (404). I wonder how I can do it through DNS and .htaccess.

As I understand Sites does not support redirecting of links like this: example.com/hey-there.html to example.com/welcome (301 redirect).

I am therefore looking to combine Sites with a redirect through DNS settings if that is possible. I have several DNS records active currently which verify ownership of the site (TXT, CNAME and one Web forward of example.com to www.example.com). Now, is it somehow possible to have a redirect of these queries.

Could you please help me out on how this can be done?

1
  • 1
    You can't do redirects using DNS unless the domain names are different (and even then, all the DNS server can do is point to another web server which does the actual redirects. (TXT records don't help, and CNAME records don't do redirection. Web forwards are not a function of DNS) I have no knowledge of Google sites, but I'd be rather suprised if they honour .htaccess files. Have you seen support.google.com/sites/thread/114066289/… - which seems to tell you how to set up redirects.
    – davidgo
    Commented Jul 14, 2023 at 10:11

1 Answer 1

-1

To get you started here is a rule in .htaccess to redirect example.com/hey-there.html to example.com/welcome

# Code generated by www.301-redirect.online
RewriteEngine on
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^example\.com/hey\-there\.html$ /example.com/welcome? [R=301,L]

You can use Htaccess Redirect Generator to generate more of them. Note it does not work with wildcards and I am not associated with it.

1
  • Google sites doesn't support .htaccess so while these rules work on most hosts, they are useless in the context of Google sites. Commented Aug 22, 2023 at 16:01

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.