3

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?

  • If you are redirecting then of course it will redirect everywhere. – Helping Hands Feb 16 '15 at 11:59
3

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.

1

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.

1

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       
  • 1
    This will open up for everyone that may tell you that there browser is "Google Page Speed Insights", so should proberly me combined with an ip filter for the google ip range. – Puggan Se Nov 13 '18 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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