mod_rewrite question
Posted: Thu, 2008-05-15 20:12
I had a question, and this might be very simple, so please excuse my ignorance.
I am building a site for my dad's construction company, it is fairly small in size so it is just static HTML pages.
What I want to do is get rid of the "index.html" from all directories for clean URLs.
example:
http://ronrossiremodeling.com/our-work/index.html
rewritten to:
http://ronrossiremodeling.com/our-work
It should only be 2 levels deep, with a sub category for different work under "our-work".
Any help is appreciated. Thanks!
http://ifohdesigns.com - Web Design That Is Neat.
http://ifohdesigns.com/blog - Read it please.


Moderator
Posts: 5672
Joined: 2005-02-22
You shouldn't need to modify
Posted: Thu, 2008-05-15 21:35
You shouldn't need to modify your .htaccess for that, index.html is normally included in the default settings. If by chance its not, you can add it using the DirectoryIndex directive, see http://httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryindex
On Having Layout | The One True Layout | menus by listamatic
Enthusiast
Posts: 277
Joined: 2008-02-22
Location: Providence, RI
Did not even think of that.
Posted: Thu, 2008-05-15 21:48
Did not even think of that. Thanks Chris
What about if instead of having the sub directories under "our-work"
I had like:
http://ronrossiremodeling.com/our-work/decks.html
and just rewrote it to not have the extension?
http://ifohdesigns.com - Web Design That Is Neat.
http://ifohdesigns.com/blog - Read it please.
Moderator
Posts: 6608
Joined: 2004-05-01
Location: Brisbane
Check out tip #5:
Posted: Thu, 2008-05-15 22:21
Check out tip #5: http://passwordrobot.com/blog/5-htaccess-tricks-every-webmaster-should-know/
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
Moderator
Posts: 5672
Joined: 2005-02-22
I wouldn't do it like tip
Posted: Thu, 2008-05-15 23:32
I wouldn't do it like tip #5. That might be ok for a handful of pages but it won't scale well. It would be possible to set up some mod_rewrite rules to add the ".html" where a .html file exists. However, its simpler to make every page an index.html. E.g. http://ronrossiremodeling.com/our-work/decks is satisfied by the page http://ronrossiremodeling.com/our-work/decks/index.html
On Having Layout | The One True Layout | menus by listamatic
Enthusiast
Posts: 277
Joined: 2008-02-22
Location: Providence, RI
perfect. Thanks to both of
Posted: Fri, 2008-05-16 00:37
perfect. Thanks to both of you for your input. I think that the straight "index.html" like I had originally planned, except without the htaccess. This will suffice for now, or until I get some type of CMS up and running for it (if he ever needs it).
In any case, thank you both once again.
http://ifohdesigns.com - Web Design That Is Neat.
http://ifohdesigns.com/blog - Read it please.