I have a URL:
“http://www.example.com/pages/about.html”
I’ve been able to get rid of the file extensions and add a “/” at the end to create:
“http://www.example.com/pages/about/”
using:
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]
Next, I need to remove the pages subdirectory folder from the URL so that I get:
If you don’t want /services/ before your services, then you’ll have to move your service pages to the “pages” folder where your other files are, and then replace
with