-1

Website source:http://www.salefee.com/

I have a career section in my website which redirects to http://www.salefee.com/index2.html

I want that that my url should look like http://www.salefee.com/career. I don't want any .html suffix after my url. I have hosted this website using www.godaddy.com

Can someone help me with the code. The website is made in html/css.Thanks in advance!!

Mike Cluck
  • 31,869
  • 13
  • 80
  • 91
D J
  • 57
  • 1
  • 1
  • 10
  • Do you have access to your `.htaccess` file? You'll need to set some rules in that – CalvT Jun 09 '16 at 16:48
  • Where is .htacess file located? – D J Jun 09 '16 at 16:50
  • Right in the root - if you haven't seen it, then you probably can't access it. But @C14L answer will work for you – CalvT Jun 09 '16 at 16:59
  • If you can access the `.htaccess`, then this question should help http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess, or this one http://stackoverflow.com/questions/6534904/how-to-remove-file-extension-from-website-address – CalvT Jun 09 '16 at 17:05
  • I have located .htaccess file...what changes do I need to make in that file? – D J Jun 09 '16 at 17:39

2 Answers2

6

Create a subdirectory /career/ in your web files directory, and then put the HTML file index.html in there.

index.html is the default file that will be returned by the server when the directory level is accessed by the browser.

Also, for SEO purposes, add a proper <link rel="canonical" href="/career"> tag in the page header.

Static blog engines like Jekyll or Pelican do it this way too.

There are more methods to achieve that, via Nginx settings or Apache's .htaccess, but since you are on Godaddy you probably need a simple solution.

tommybananas
  • 5,718
  • 1
  • 28
  • 48
C14L
  • 12,153
  • 4
  • 39
  • 52
3

Add the following to your .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+?)/?$ $1.html [L]

This feature is often called "Pretty URLs" or "Permalinks".

So now if you want http://www.salefee.com/career, in the same place you put your index.html - often called public_html - put a html file called career.html

CalvT
  • 3,123
  • 6
  • 37
  • 54