Google Cloud Storage- How do I redirect urls?

3,149 views
Skip to first unread message

Video Games101

unread,
Sep 6, 2017, 9:09:06 AM9/6/17
to Google Cloud Developers
Hi so I have uploaded my site to Google Cloud Storage. Everything is working well except for one thing-

My site's url is example.com or http://example.com. See the thing is my site already has quite a lot of links on the internet. some are example.com and others are www.example.com. What i wanna do is redirect all my www.example.com urls to example.com . For example- www.example.com/page1.html to example.com/page1.html


This is usually done through htaccess but google cloud doesnt support htaccess so... any ideas???

Carlos (Cloud Platform Support)

unread,
Sep 6, 2017, 3:30:13 PM9/6/17
to google-c...@googlegroups.com

Assuming that you have a bucket “www.example.com” and what you want is to redirect the content that is not found on it, you could do it by coding a custom 404.html page. Your code in the 404 page would be in charge of doing the redirect to "example.com" domain.


Dave Parizek

unread,
Jan 15, 2022, 12:07:04 AM1/15/22
to Google Cloud Developers
Another way is to switch to using a Load Balancer - which would allow you to also serve up your content via https instead of http.
There are associated costs, including per redirect that you setup, of course... hopefully one wildcard redirect would serve your purpose.

Reply all
Reply to author
Forward
0 new messages