Need help with problem related to .htaccess, getting rid of the .html in a url, and Dreamweaver

by youngsiteowner Banned
2 replies
Hello everyone. I am in the process of finishing my website so that I can launch it on New Year's Day but I have run into a problem. I need the URL's to look like "/blog" and "/contact" instead of "/blog.html" and "/contact.html". I was able to do that in the .htaccess file by putting in the following code:

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
But the buttons on my page still go to /blog.html instead of /blog even when I directed them to go to /blog in Dreamweaver.

If anyone can help me, I would greatly appreciate it. Thanks!
#dreamweaver #htaccess #html #problem #programming #related #rid #url #web design
  • Profile picture of the author Mkj
    Originally Posted by youngsiteowner View Post

    Hello everyone. I am in the process of finishing my website so that I can launch it on New Year's Day but I have run into a problem. I need the URL's to look like "/blog" and "/contact" instead of "/blog.html" and "/contact.html". I was able to do that in the .htaccess file by putting in the following code:

    Code:
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.html -f
    RewriteRule ^(.*)$ $1.html
    But the buttons on my page still go to /blog.html instead of /blog even when I directed them to go to /blog in Dreamweaver.

    If anyone can help me, I would greatly appreciate it. Thanks!
    I think htaccess redirectmatch will work:

    Code:
    redirectMatch 301 ^(.*).html $1
    The above will remove ALL html extentions.
    {{ DiscussionBoard.errors[7533858].message }}
  • Profile picture of the author youngsiteowner
    Banned
    Thanks Mkj. But I found the problem. It works with the code I mentioned in my first post. My problem was that I had my website in a folder of the domain name.

    By the way, .htaccess is a pain.
    {{ DiscussionBoard.errors[7533958].message }}

Trending Topics