Quantcast
Channel: Tricky .htaccess settings
Viewing all articles
Browse latest Browse all 10

Tricky .htaccess settings

$
0
0

@raseone wrote:

I wanted to add that I got this much of it all working together:

Options -Indexes

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

FORCE HTTPS

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

REDIRECT INDEX TO ROOT

RewriteRule ^index.php$ / [R=301,L]
RewriteRule ^index.htm$ / [R=301,L]

STRIP UNWANTED QUERY STRINGS FROM ALL BUT EXEMPTED FILES

RewriteCond %{query_string} .
RewriteCond %{THE_REQUEST} !^./font.php?(.)
RewriteCond %{THE_REQUEST} !^./free_font.php?(.)
RewriteRule (.*) /$1? [R=301,L]

SET CUSTOM ERROR PAGES

ErrorDocument 400 /error/error_400.php
ErrorDocument 401 /error/error_401.php
ErrorDocument 403 /error/error_403.php
ErrorDocument 404 /error/error_404.php
ErrorDocument 500 /error/error_500.php

One main conflict was that:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Were interfering with the force https rule. I’d like to understand why?

There is a conflict between the the rules that prevent unwanted query strings and the rules I’m building to do the “pretty urls”. All of the files are on the same directory level so I might be able to work around it by placing some down one level. I’d like to have a better solution though.

Read full topic


Viewing all articles
Browse latest Browse all 10

Trending Articles