How Do I Eliminate Sub Folder From URL

New to mod_rewrite? This is a good place to start.

Postby richardk » Sun Oct 11, 2009 3:41 pm

Before i start does it matter if I end with the forward slash/

No, but i suggest you pick one or the other. You could even set up a redirect to force the type you choose.

Can you do me a bit of code so I can remove the .html from top level, like index.html, tutorials.html, infromation.html, aboutme.html and contact.html.

This should work for all document root level files
Code: Select all
# Check if the file exists in your document root with a .html extension.
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^([^/]+)/?$ /$1.html [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby helpvid » Sun Oct 11, 2009 4:07 pm

Thank you Buddy, sure appreciate you taking the time to help me;-)
helpvid
 
Posts: 15
Joined: Thu Oct 08, 2009 2:17 pm

Postby helpvid » Sun Oct 11, 2009 4:18 pm

I put the code as follows

#Remove The Root Level .html extension.
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^([^/]+)/?$ /$1.html [QSA,L]

Never worked, although remember the last time it took time so I will wait as it's not messing anything up.

Just sending this In-case I was supposed to add something to the code like my website address.
helpvid
 
Posts: 15
Joined: Thu Oct 08, 2009 2:17 pm

Postby richardk » Mon Oct 12, 2009 2:16 am

/information works fine for me.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby helpvid » Mon Oct 12, 2009 4:43 am

Ye still the same here (next day), might be ok from the other end. I will check it out on Wednesday from my friends computer.

Thanks Again Richard.

Do you have a website, Whats your Address?
helpvid
 
Posts: 15
Joined: Thu Oct 08, 2009 2:17 pm

Previous

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 6 guests

cron