Hi, people of the forums!
I'm fiddling with my .htaccess file, and I've run into some issues.
Before I continue, please note that I know next to nothing about .htaccess files, my apologies!
Now, originally a nice support rep fixed my previous .htaccess file, using this code.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.html\ HTTP
RewriteRule (.*)\.html$ $1 [R=301]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.html [L]
</IfModule>
It works splendidly!
However, I wanted a trailing slash at the end of the url. With this code, it displays "websitedotcom/about," when I'd rather "websitedotcom/about/"
It's a small issue, but it DOES return with an error if I try to add a trailing slash to the url. I could use permanent redirects to fix it, but I have a lot of pages to fix.
So, in my quest for finding codes to add a trailing slash, I tried this code that I found online.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
</IfModule>
This works well too! Except for one problem.
I have 2 folders and 1 subdomain. The folders are using index.html files, and I specify them in links as their directory name. (websitedotcom/directoryindex/, which is an index.html)
The subdomain is for my forum, websitedotcom/forum/
Now, when I try to click websitedotcom/directoryindex/ or websitedotcom/forum/, I get a 404 error page, and I'm assuming this is because the codes I used edit out the .html file extension, add a trailing slash to it. SO, the code either doesn't find the websitedotcom/directoryindex/ folder because it's a folder, not an html file, or it's conflicting some how by editing it to websitedotcom/directoryindex//
I'll use the original code for now until I find a better solution. It's not exactly a dire problem, I was just curious as to why the new code conflicts with directory index files, and what a possible fix would be in order to display index files properly, while still having other html pages having a trailing slash.
Thanks in advance.