|
|
#1 (permalink) |
|
Registered User
Comfy Contributor
Joined in Jun 2006
106 posts
Gave thanks: 5
Thanked 1 Time in 1 Post
|
.htacess rename engine?
i have a bunch of .html files on a site, and i'd like to change it so that i can type in site.com/index and it'll know to look up index.html
any ideas? thanks! |
|
|
|
|
|
#2 (permalink) |
|
Skittles
Super #1
Joined in Aug 2004
Lives in Space ship
Hosted on dedi
6,480 posts
Gave thanks: 91
Thanked 176 times
|
You can do this with mod_rewrite. I haven't been able to figure it out with the quick looks I've taken at it, but that will give you an idea of what you are searching for. You can also check on http://www.modrewrite.com/ to learn more about it. I'm sure one of the members here can give you exactly what you need to use though
__________________
Mountain Dew Knight
People should not be afraid of their governments. Governments should be afraid of their people. |
|
|
|
|
|
#3 (permalink) |
|
Surpass Fan
Super #1
Joined in Aug 2004
Hosted on SH58
1,687 posts
Gave thanks: 6
Thanked 7 times
|
Something like this in your .htaccess file:
Code:
RewriteEngine On RewriteBase / RewriteRule ^[a-zA-Z0-9_\-]$ $1.html
__________________
- Evan Charlton | [site] | Server - SH58 |
|
|
|
|
|
#5 (permalink) |
|
Surpass Fan
Super #1
Joined in Aug 2004
Hosted on SH58
1,687 posts
Gave thanks: 6
Thanked 7 times
|
Try simplifying the last line to this:
Code:
RewriteRule ^[a-zA-Z0-9]$ $1.html
__________________
- Evan Charlton | [site] | Server - SH58 |
|
|
|
|
|
#7 (permalink) |
|
Surpass Fan
Excelling Contributor
Joined in Nov 2005
Lives in Colorado
Hosted on DEDI
924 posts
Gave thanks: 2
Thanked 91 times
|
This is fine if there are no sub directories with an index file for default delivery without any file name specified in them. It would redirect a call for this_directory/subdirectory/ to this_directory/subdirectory.html because of the /? in the pattern.
RewriteRule ^(index)$ $1.html for only an index append of .html or RewriteRule ^([a-zA-Z0-9])$ $1.html for an append of .html for any filename without an extention.
__________________
Where would you be if you were at the highest court in the land (US)? |
|
|
|
| This user thanks cowboy for this great post! | Savesheep (January 15th, 2007) |