Having some trouble with .htaccess and conflicting rules. Code below:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Options +FollowSymLinks
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
DirectoryIndex index.php
RewriteRule ^home/?$ index.php [L]
RewriteRule ^([a-zA-Z0-9-]+)?$ static-page.php?slug=$1 [L]
The pages based on static-page.php work fine but when I try going to '/home' the page loads for a while then gives me nothing. I believe this is because the second rule is overwriting the first one.
Anyone know how to solve this?
Thanks,
Try this corrected code:
DirectoryIndex index.php
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^home/?$ index.php [L]
RewriteRule ^([a-zA-Z0-9-]+)?$ static-page.php?slug=$1 [L,QSA]