Forum

Thread tagged as: Problem, Error, Runway

Runway rewriting causing 404s

I've just deployed Perch Runway to my live site and am not getting 404s on my css and javascript. I'm also getting a 404 on the www version of my site. The 404 that is being used is going through Perch's rewriting. As such, I am also not even able to access the Perch admin.

My set up is the same for my local and live environment, using the same htaccess:

#allows everything if its on a certain host
SetEnvIf HOST "^mysite.local" local_url
#SetEnvIf HOST "^mysite.co.uk" live_url
Order Deny,Allow

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/passion1/public_html/.htpasswd
AuthGroupFile /
Require valid-user

#Allow valid-user
Deny from all
Allow from env=local_url
Allow from env=live_url
Satisfy any

# Perch Runway
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/admin 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /admin/core/runway/start.php [L] 

And the same config.php.

It is only when I remove the rewrite conditions am I able to access static content.

Mike Barker

Mike Barker 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

A good first step is to start commenting things out to see if a simpler case works.

Can you try with just the Runway section?

As soon as I comment out the RewriteRule .* /admin/core/runway/start.php [L] line my htpasswd starts working (forgot to mention that it wasn't before) and I am able to go the admin panel, log in and edit content as would be expected.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure, but that's because you're disabling the rewrite, so it doesn't help much!

Can you try with just the Runway section?

How strange, that's fixed it immediately. I tried the same thing earlier and it wouldn't work. Maybe some caching issue or something.

Any ideas on being able to htpasswd my website with Perch in the mean time?

Maybe not, the error persists when going to the www. version of my site.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does the www. version point to the same place?

It does yes. Strangely, when on the www version Perch throws the error "Perch could not connect to the database, Please check that the access details specified in config.php are correct." despite the config being the same for the non-www version.

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's something not the same, then. Does your config branch based on host name?

Sure does, I didn't realise I needed a case in there for www. so I've added that now. Thanks for the help with it.

Do you know how I can lock down the site as I was trying in my original example? With Perch rewriting urls the htpasswd seems to not want to work.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't know enough about the apache directives you're using to be able to say which order they should be placed it, but that's a good place to look. Try moving the rewrites to the top.

Ok thanks, I tried moving the rewrites to the top like you say but that didn't seem to solve it. Is not that big a deal to be honest.

Appreciate this is an old post, but so not to duplicate, I'm having this same issue. I've a VPS on Memset with the following in Htaccess:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/charme/.htpasswd
Require valid-user

# Perch Runway
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/admin  
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /admin/core/runway/start.php [L] 

Access to any assets (images, js, css) is blocked, but the HTML itself renders. Any pointers?