Anyway i can have "clean" urls?

tracked

New Member
Messages
6
Reaction score
0
Points
1
Hi Guys,

Sorry if this has been asked before but is there anyway I can have clean URLS? for example right now urls look like this:

http://vaughnemotes.x10.mx/video.html

Can I remove the video.html etc... at the end and have it looking something like:

http://vaughnemotes.x10.mx/video

The site works so it's no big deal but this and age showing the "html" pages names is not really done. Any help would be appreciated.

-thanks
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
This can be done in a site .htaccess file by using mod_rewrite rules. Someone else may be able to provide a more detailed explanation on how it can be accomplished, however.

Moved to Programming forum, as this question is not directly hosting-related.
 

tracked

New Member
Messages
6
Reaction score
0
Points
1
anyone?... i have tried using rewritebase but i must be doing something wrong because nothing I do works... HELP!! please :(
 

tracked

New Member
Messages
6
Reaction score
0
Points
1
I finally managed to work it out after hours of scratching my head, you can use this in the .htaccess file to take off html extension in URL's (you can also use this for php, just change the extension from html to php in the code):

Code:
RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

That code would then change a url like this: http://my.example.com/video.html to http://my.example.com/video and so-forth. Just make sure in your HTML files you are using links like: <a href="video"> instead of <a href="video.html"> etc...

-hope this helps others from further head scratching!!
 
Top