Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
.htaccess with two redirect scenarios

My website is completely done in HTML for example at: example.com

When I go to the "Contact" page the address looks like this:

example.com/contact.html

I would like two scenario that will direct to the address with a "/" suffix:

  1. example.com/contact.html -> example.com/contact/ (removes the .html from the address and adds a "/" at the end)
  2. example.com/contact -> example.com/contact/

Currently I only have number 1 in .htaccess:

#example.com/contact/ will display the contents of example.com/contact.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^([^/]+)/$ $1.html [L,QSA]

#301 from example.com/contact.html to example.com/contact/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1/ [R=301,L]

How to add a second scenario?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!