Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

HarryPot

macrumors 65816
Original poster
Sep 5, 2009
1,085
548
I have two things I would like to change:

1. When entering my page www.domain.com, the URL is displayed as I would like it to show: "www.domain.com".

But whenever I return to my homepage, it adds "/index.html" to the end, so I have: www.domain.com/index.html

2. Every other page shows, www.domain.com/products.html, or /contact.html, etc.

I would like that the homepage never shows "/index.html", and that the rest of the pages don't show the ".html". How can I achieve this?

Thanks.:)
 
You need to configure your server. Most/all web servers have the ability (often by installing or enabling a plugin) to re-write URLs.

Nobody can give you specific advice, though, without knowing what server you are using.
 
I have two things I would like to change:

1. When entering my page www.domain.com, the URL is displayed as I would like it to show: "www.domain.com".

But whenever I return to my homepage, it adds "/index.html" to the end, so I have: www.domain.com/index.html

2. Every other page shows, www.domain.com/products.html, or /contact.html, etc.

I would like that the homepage never shows "/index.html", and that the rest of the pages don't show the ".html". How can I achieve this?

Thanks.:)

If you have an Apache server you can use a ".htaccess" file to redirect however you want. There are many tutorials on how to do this. Use Google to find them.
 
I believe all you need to do is change the links on your site. Instead of linking to "index.html" for the homepage, link to "/". Then for the rest of the pages on your site, put them inside of subfolders. Such that the url would be "www.domain.com/products/".
 
You need to configure your server. Most/all web servers have the ability (often by installing or enabling a plugin) to re-write URLs.

Nobody can give you specific advice, though, without knowing what server you are using.

I see a folder named "aspnet_client".

I did search Google and found something about .htaccess, but I have no idea how to do it. Is .htaccess a file format? How do I make one?

-------------------------------

OK, I created a".htaccess" and uploaded it to my server. In the same directory as index.html is.

Inside the htaccess file I wrote:

Code:
Options +FollowSymLinks
RewriteEngine on
# index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
 
Last edited:
If you have access to the server configuration, setting the "DirectoryIndex" (for example, in Apache) directive tells the web server which filenames are considered directory indexes and will be loaded by default in a given path even if not specified. Should be set in global portion of config but can be added to .htaccess or virtual hosts.

http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex

Example:
DirectoryIndex index.html index.htm index.php

Points to clarify:

1) Make sure all your links do not include any filename specified in the directive
2) Directory native .htaccess files with URL redirection or URI re-writing are excellent suggestions but are intended to OVERRIDE the GLOBAL settings in the config file, so if you ensure all links are set right and set DirectoryIndex globally, that will solve the fundamental issue of the OP. It will not solve issues related to dynamic link creation of course so I don't dismiss such advice entirely.

Knowing when to do what is key to avoiding conflicts in settings.

Hope this helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.