Forum

Thread tagged as: Question

Perch Runway redirect to template/pages

Im trying to get a correct redirect to Runway templates/pages folder so my new site can be shown at www.mydomain.com. Cant get it to work properly. Is there a proper guide on how to do this? I have my CSS, folders, images and everything else build in my perch/templates/pages folder, and want this to be shown at www.mydomain.com.

Erick Green

Erick Green 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Your assets like CSS and images shouldn't be in the template/pages folder. That folder is for your master pages.

Okay. Can have my blog folder in templates/pages? This is what I get when i use the rewrite configuration from the docs: https://bildr.no/image/Z0d4UEJP.jpeg

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

Drew McLellan 2638 points
Perch Support

Yes, put all your master pages in templates/pages. You don't need any pages out in your site.

Did you see this error? https://bildr.no/image/Z0d4UEJP.jpeg

Do I need to change my rewrite rule?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I get the error above (screenshot) when i use the Apache with mod_rewrite from the docs. When i try to change the RewriteRule from

RewriteRule .* /perch/core/runway/start.php [L]

to

RewriteRule .* /perch/templates/pages/ [L]

it shows the mydomain.com/perch/templates/pages/ URL in my browser and most of my internal links are dead.

Why are you changing the rewrite rules from the default rules as directed here https://docs.grabaperch.com/runway/getting-started/installing/rewrites/

What are you expecting? How is it failing?

Non of your urls should be showing the path to the templates as all of this is handled within runway. Your urls should be like domain.com/fancy_page and runway will connect that URL to the template you direct in page settings. Your path to the actual template will never be part of the URL.

That was just a test to see if i can could get something out of if. When i use this code, nothing happens.

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

When i use this code, i get the error shown above.

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

Drew McLellan 2638 points
Perch Support

What do you mean by nothing happens?

It just show my old site still. Ive tried several devices, deleting cookies etc. I run two Perch installations on my server, could that be a problem? They have different folder names, seperate databases and one is regular Perch and the other is Runway.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that would be a problem. Those default rewrite rules assume that you have one site per virtual host.

Is this working in your dev environment? Or is that multiple sites in one too?

Have the same two sites there as well. I guess i can delete the regular Perch folder as the Runway is our new site. Will that do the trick?

Drew McLellan

Drew McLellan 2638 points
Perch Support

In the first instance I'd suggest sorting our your dev environment so that you're in a position to set up a fresh site per project. Then you can test any changes before thing anything to a live site.

Im sorry. I have two perch installations on my FTP-server. The regular perch is running live on the root and the Perch Runway, which is our new site, is running in the back as we add content to it. The idea was to use rewrite to get a smooth transition from the old page to the new page. As im starting to get to know Runway better im not sure this was a good idea afterall. Is this even possible?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think it's probably possible, but it's beyond the scope of what we can offer advice on.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sounds like you've got it working.

Not quite. I still got the error even tho i've removed my first perch installation and everything that comes with it. I now only got one Perch Runway installation on my server. But why do I get the error shown above? It says "Sorry, that page could not be found", which is the text in Perch 404 template. So it does find the errors/ folder located in my templates/pages/ folder, but not my index.php or any of the other files located in the same templates/pages/ folder. Very strange considering Ive just got it working on another server of the same kind. Could the two perch installation be an issue even after ive deleted one installation and emptied the database? I cant really see why tho.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have a matching page in your pages list? Or a matching route?

I think so but im not 100% sure. I had to jump on another project, will come back to you on this one.