How do I test a site with Google PageSpeed when I have configured it to redirect for all IP addresses but mine?

How do I test a site with Google PageSpeed when I have configured it to redirect for all IP addresses but mine? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the How do I test a site with Google PageSpeed when I have configured it to redirect for all IP addresses but mine? error on your web browser. Problem :


In a website I'm working on I've set a 302 redirect with .htaccess for all IP but mine.



Now I want to test the site with the online tool of Google PageSpeed, but it's redirected. How can I do this?


Solution :

You may temporally (during your checks) do not redirect for the usual Google IP range that is used by PageSpeed: 66.249.64.0/19.



But note that this will open your site to Google bots, so you also need to change your robots.txt file to disallow them:




User-agent: Googlebot
Disallow: /



Another approach would be to use some performance checker addon from your browser, like YSlow, rather than calling Google PageSpeed.



You can allow Google Page Speed Insights by its User Agent in your .htaccess:



SetEnvIfNoCase User-Agent .*Google Page Speed Insights* page_speed_insights

Order
deny,allow
Deny from
all
Allow from 127.0.0.1 # your IP
Allow from env=page_speed_insights


You will have to disable the redirects. You can disable the redirect to one specific page via .htaccess if you really don't want anyone to access the entire site. Pagespeed runs pretty quick so disabling the redirect wouldn't have to last more then a few minutes.


We hope that this article has helped you resolve the redirects, ip-address, google-pagespeed error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=