FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

.htaccess instead of mod_rewrite

 


jasperlevink
Hello Folks!

I heard it is possible to use .htaccess files instead of the option mod_rewrite to rewrite urls to search engine friendly ones.
I'm not able to enable mod_rewrite so I hope someone can tell me how to do this with .htaccess.

Grtz.
Jasper
mathiaus
mod rewrite is done through .htaccess files and I'm unaware of any other way through htaccess sorry.
dandelion
You might try to use Redirect* directives from the mod_alias module.
mylogz
Mod_rewrite is actually part of the .htaccess stuff. if u dont know anything about .htaccess, here is a brief intro...
it works on Apache server and can b used to do stunts like redirectiing, url rewriting, blocking ips, preventing directory indexing, preventing hotlinking and a whole lot of others
u start by simply creating a file wt a text editor(i recommend notepad on windows) and naming it .htaccess HINT: to force notepad to name the file .htaccess, quote it wt a quotaion mark..as in somthing like ds: ".htaccess"
then ur coding comes in....and u upload it to the directory u want it to work on
here is a snippet from d one im using for my site:
Code:

RewriteEngine on
RewriteRule ^dir/([0-9a-zA-Z\.\-_]+)/([0-9a-zA-Z\.\-_]+).php$ display.php?d=$1&sd=$2



the first line is used to tell d engine im strating some rewriting stunt.
the rewriteRule line means replace any url like www.ngbot.com/dir/arts/arts.php wt www.ngbot.com/display.php?d=arts&sd=arts. so instad of creating a page for every subdirectories and folder for every directories in the site, i redirected them to display.php which actually goes to my db and selects the directory and subdirectory for display Very Happy thats a secret however so dont tell anyone...
for more on htaccess....search something like mod_rewrite in G!....
hope this helps
Simulator
I find this to be the best website:

http://www.workingwith.me.uk/articles/scripting/mod_rewrite/
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.