Forum
mod_rewrite Internal Server Errors
I'm working locally on a Perch website using MAMP. I have been able to get mod_rewrite working to hide extensions with no problem, but I can't blog pages to work. I get Internal Server Error messages. I have the same issue when uploading to my MediaTemple server.
This is my .htaccess file:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
# RewriteCond %{HTTP_HOST} ^blackhawkpetcare.com.au [NC]
# RewriteRule ^(.*)$ https://www.blackhawkpetcare.com.au/$1 [L,R=301]
# Redirect to PHP if it exists.
# e.g. example.com/foo will display the contents of example.com/foo.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
RewriteRule ^post/([a-zA-Z0-9-/]+)$ /post.php?s=$1 [L]
</IfModule>
Redirect 301 /about /about-blackhawk
Any ideas on what might be wrong?
Not really a Perch question, but try moving your rule for blog to come before the catch-all rule.
Thanks Drew. I understand it's not a Perch issue, just struggled to find somewhere to get help.
That fix didn't work locally, but does work on the Mediatemple staging server.
Any tips on where/how I can debug mod_rewrite issues locally?
I wrote a bit about it here: https://24ways.org/2013/url-rewriting-for-the-fearful/