Forum

Thread tagged as: Question, Configuration, Runway

URL rewriting and site default page

Hi

I have a site configuration in Perch Runway, where the first page in my site is /home (home.php). I would like root (/) to default to this page.

I have setup my standard URL rewrite rules in my httpd.conf file (WAMP). To achieve this, will I need a specific rule to handle the case that when root is browsed (i.e the domain) then the home page is displayed? Or is there the ability in the Perch console (or indeed config.php file) to set a default landing page for the site?

Many thanks

Vinay Jagessar

Vinay Jagessar 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There's nothing specific built in for that sort of redirect - you'd be best to add a rewrite rule for it.

Thanks, thought that might be the case.

Whats the default behavior for a Perch installation? Will the home page use the default.php master with the standard redirect rules and thus browsing to localhost (for a development installation) will load the home page?

I was considering changing home.php to index/default.php and replacing the url from /home to /, however running WAMP its just loading the default WAMP page with the SITEPATH set to www/perch and and the directory set to www/ in httpd.conf.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think by default the / route points to home.php

Thanks

Would the rule sit above the current rewrite rule for runway?

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/perch 
RewriteCond %{REQUEST_FILENAME} !-f

#Home redirect
RewriteRule ^${HTTP_HOST}$ /home [NC]

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

I have tried using a redirect in the index.php or home.php in the root of my public_html (probably not the ideal solution). I get the 404 page, suggesting its failing to do the redirect along with the rewrite rule above.

Most hosted Perch sites must require this, what would you suggest?

Many thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried

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

Great, many thanks !