2

Hi All i have a problem that my file have .html extention but i want that when the file open in brownser the extention had hidden.e.g file.html to file. Advance thanks

4 Answers 4

5

In your .htaccess file use this:

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

Now you can use lins like http://www.mysite.com/contact rather than http://www.mysite.com/contact.html.

Hope this helps!

Sign up to request clarification or add additional context in comments.

3 Comments

thanks but problem is that they show the contact page in browser but when i write in browser contact.html here extentionshow till refreshing the page.
I read up to contact.html and you've lost me. What is it you're trying to do?
make a page contact.html and write the .htaccess and past the above code in .htaccess.now file open in browser they will show you contact but problem is that when you write the .html with contact page in browser then extention is showing but i want extention will no show if i write the .html extention in browser then page no expect this extention .see this link myatlantainjurylawyer.com
1
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/$ $1.php RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ RewriteRule (.*)$ /$1/ [R=301,L] 

Example yoursite.com/wallpaper.html to yoursite.com/wallpaper/

Comments

0

Your link must be like this

<a href="example">Example</a> Instead of <a href="example.php">Example</a> 

Then add this to your .htaccess file

 RewriteCond ^example example.php [L] 

Comments

0

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

this one is ok for single extensions in one website. I am using multiple extensions in same website for example index.html and contact.php.

How can i use this code ?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.