I created an htaccess file that I saw on a tutorial. My main goal was to remove the .php at the end of the file names in my browser. This worked perfectly. However, I am running into some major issues since I have created this.
Anything that has a method of POST will not process. It just reloads the current page, but does nothing.
When I try to log in, it redirects me to my home page. Then when I go back to the signin page, it allows me to log in.
My font-awesome images are no longer displaying.
Issue 1 and 2 are definitely the most important issues that need resolved. I've been stuck on this for days and cannot find anything that resolves this.
This is what I currently have that loads my pages fine, except for the issues I mentioned.
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example/$1 [R,L]
RewriteEngine On
RewriteBase /
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
RewriteRule ^er$ er.png [L]
RewriteCond %{REQUEST_METHOD} !POST [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
This last part ^^ is one thing I tried to add to make the POST's work. It did nothing. It is positioned in the file just as I posted it in here.
I also tried using the following that someone created for me, but it doesn't even allow me to get on my site.
RewriteEngine On
# redirect to https
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mysite/$1 [R,L]
# allow cross origin fonts
<FilesMatch ".(eot|ttf|otf|woff)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
# add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
# allow php files to respond without extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# remove php extension if provided
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\\.php [L]
I have all of my POST methods directing like the following.
action="/index"