Forum

Thread tagged as: Question, Problem, Error

URL RewriteRule Assistance

One of my Perch sites uses .htaccess to change the .php extensions to .html using:

AddHandler php5-cgi .html .htm. 

This works great.

Now I'm interested in allowing pages to be accessed with or without the .html being used. I added the following to my .htacces file and this also works great.

RewriteEngine On
RewriteRule ^([^\.]+)$ $1.html [NC,L]

The issue I'm having is that when I try to access Perch to edit the site I receive a 403 error. Is there a way for me to update my .htaccess to allow for my current configuration to work as well as Perch?

Ryan McGuire

Ryan McGuire 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Make sure you exclude the perch folder.

RewriteRule ^perch - [L] 

Do I just add this code below my .html RewriteRule? I attempted this, but I'm still receiving the 403 error when attempting to access Perch.

I added it above my code and it started working ;)

Thanks for your help.