0

I am creating a website and cannot figure out how to set clean URLs throughout all my webpages. Is there a way to do this without .htaccess? If no how can I accomplish with it? I'm using Apache.

This is an example of what I have now, which I do not want:

www.example.com/about.html

This is what I want the URL to look like:

www.example.com/about/
unor
  • 92,415
  • 26
  • 211
  • 360

3 Answers3

0

For .html you can code below, it will rewrite request when you .html is enter in url.

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]
Tengku Fathullah
  • 1,279
  • 1
  • 18
  • 43
0

Unless your Apache is configured differently, the file /about/index.html will be returned under the URL /about/.

By default, Apache looks for a file named index.html, but this can be changed with the DirectoryIndex directive.

unor
  • 92,415
  • 26
  • 211
  • 360
0

You must create the file .htaccess in your server and add this code in it:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]