Create Pretty Url from Plain Html Page?

I have looked over several articles on setting up "Pretty URL's" and I can't seem to get anything to work for me. I am new to the whole .htaccess process and it seems like everything I've seen is geared toward dynamic, .PHP based sites. Here is what I would like to see happen:

Ugly URL:
Pretty URL:

What it am currently trying to use in the .htaccess file is:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-z]+)$ $1.html

Thus far, I've had no luck. I am not using any form of .php on the page - these are static .html pages. Any help would be extremely appreciated. Thanks!

4

1 Answer

Nevermind. I figured out what issue was. My compiler was corrupting the .htaccess file, which was triggering the site-wide error message on load. You can see that it's working now here:

or

Here's the basic code that I used:

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

Thanks for all of your help. Cheers!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest