RewriteEngine On
Options -Indexes

<IfModule mod_headers.c>
	Header set Access-Control-Allow-Origin "*"
</IfModule>

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]

RewriteRule ^(proposal_files|ajax|sections|coupons)($|/) - [L]
RewriteRule ^(.*)/([\s\S]+)$ proposal.php?username=$1&proposal_url=$2

#RewriteRule ^(.*)/([0-9a-zA-Z-_-]+)$ proposal.php?username=$1&proposal_url=$2

# RewriteCond %{HTTP_HOST} !=localhost
# RewriteCond %{HTTP_HOST} !^www\.
# RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [NC,L]

# #Now, rewrite to HTTPS:
# RewriteCond %{HTTPS} off
# RewriteCond %{HTTP_HOST} !=localhost
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,L]