0

I have a website on a server with every file in the same folder. For my links on the website, I use simple for the links with the name of the file with a html or php extension.

I want to hide the HTML and php extensions and replace them with /name/. I have located an .htaccess file on the server and I have deleted the content. I read and tried the examples given in the other questions but non of them worked.

  1. What is the usual process of eliminating the extensions?
  2. Does it have anything to do with how I am linking the files?
  3. Is it possible to name the files without the extension altogether?
Keval Domadia
  • 4,768
  • 1
  • 37
  • 64
  • htaccess is the way to go. What did you try? What didn't work when you tried it? You can't just rename the files in the file system, that'll break things! – Novocaine Feb 21 '14 at 17:01

1 Answers1

0

put this script in your htaccess file

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

i use it my self works in removing the .php extension.For html replace .php with .html/.htm(depends on the extension you use)

Dev Man
  • 2,114
  • 3
  • 23
  • 38
  • I added this to the .htaccess file, and there are still extension names in the url. There may be something off about my set up for these answers to not effect the site. – user3338166 Feb 21 '14 at 17:30
  • @user3338166 where is htaccess located(root/other folder) also which server are you using? – Dev Man Feb 21 '14 at 17:32
  • hmmm, my files are on a server and are located in a folder called public_html including the .htaccess file. – user3338166 Feb 21 '14 at 17:36
  • but @user3338166 is the files on a hosting service like godaddy.com? because if it is some web hosting service providers donot allow modifications to htaccess files they somehow block it . – Dev Man Feb 21 '14 at 17:46
  • I am using hostmetro. Deos that include hostmetro? – user3338166 Feb 21 '14 at 20:47
  • @user3338166 i dont know,may be.you need to call costumer care and find out :-) – Dev Man Feb 21 '14 at 21:10