Forum

Thread tagged as: Question, Problem, Configuration

Possible URL rewriting issues with displaying non-home pages on a website

Hi Drew/Rachel

I’m in the process of creating a website for my client using Perch 2.8.17.

This has been running smoothly on Mac OS X 10.11.1 El Capitan using MAMP Pro 3.4 (PHP version 5.4.42).

I’ve FTP'ed the website/CMS files to a Heart Internet Premium Web Hosting account and the SQL file to the remote database via phpMyAdmin.

The server runs on Apache 2.4.12 with PHP 5.4.45 and MySQL 5.5.5-10.0.22-MariaDB.

The Perch Config file has been set to the database connection details of the MySQL database set-up on the Heart Internet account and the CMS is able to be loaded, logged into and accessed from the browser - so all is good there.

I am however having trouble getting the htaccess file to work for displaying the actual pages of the website itself (not the CMS).

The htaccess file is placed in the root of the public_html directory along with the perch directory and index.php file - exactly the same set-up as on my local development installation with MAMP Pro.

When accessing the remote website via the browser the home page displays but subsequent pages will not load, instead a Not Found screen is displayed for all non-home pages.

Here are the htaccess rules that I use on my MAMP Pro installation (that is able to access pages without any issue or complaint):

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ $1.php [L,QSA]       
</IfModule>

These however don’t work on the Heart Internet hosting account (where htaccess/mod_rewrite is enabled) and I was wondering if you might be able to provide any suggestions/guidance on why this might be?

I have logged into and checked in the remote Perch CMS and ALL pages are there (I.e. gallery, services etc).

Is there something I am missing/have forgotten to do when transferring the website/CMS to a remote server? I believe the problem is htaccess/rewrite rule related but I'm an absolute amateur with htaccess/mod_rewrite I’m afraid so I appreciate any assistance you can provide with this query as it’s driving me a little nuts!

James Griffiths

James Griffiths 0 points

  • 5 years ago

Hi James,

I had a similar problem with my hosting. Putting this right at the top of the .htaccess file fixed it for me. Not a .htaccess expert myself but it's worth a shot!

Options -MultiViews

Hi John

Many thanks for taking the time to provide a helpful suggestion.

I'll try what you've recommended (when I return from work) and see how I fare!

Appreciate your help (especially if it works!)

Kind Regards

James

Hi John

Sorry to say that didn't work! Thanks all the same though

Kind Regards

James

Ah, sorry about that James. It fixed the same problem for me but as I said I'm far from an expert with .htaccess. Hope you get it sorted soon.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried the examples from the documentation?

https://docs.grabaperch.com/runway/installing/rewrites/

Hi Drew

Sorry I'm so late in replying (things have been hectic with work).

I'm glad to say this is resolved now (after much fretting on my part!) so thanks for your help and to John Robinson too for his replies to this thread.

Really appreciate the time and assistance (and congratulations on a great CMS product too).

Kind Regards

James