NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page htaccess questions

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-23-2007, 10:51 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
w1ww's Avatar
Join Date: Oct 2006
Location: Mars.
Posts: 439
w1ww is a jewel in the roughw1ww is a jewel in the roughw1ww is a jewel in the rough
 



htaccess questions


Hi,

What do I have to place on my htaccess so a link like 'index.php?author=MyName' to be displayed as folder/Myname/ ?

Thank you!
__________________
:notme:
w1ww is offline  
Old 02-23-2007, 11:09 AM   #2 (permalink)
Senior Member
 
Hitch's Avatar
Join Date: Aug 2005
Location: Uk, South Yorkshire
Posts: 1,225
Hitch is a splendid one to beholdHitch is a splendid one to beholdHitch is a splendid one to beholdHitch is a splendid one to beholdHitch is a splendid one to beholdHitch is a splendid one to beholdHitch is a splendid one to behold
 


Winner
PHP Programming - May 2007
Animal Rescue Third World Education Find Marrow Donors!
Use this, http://www.webmaster-toolkit.com/mod...enerator.shtml
__________________
Cueburst - Support System - FAQ Knowledge Base, Tickets and more.
Hitch is offline  
Old 02-23-2007, 11:10 AM   #3 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,552
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
What you need is mod_rewrite instead.
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline  
Old 02-23-2007, 11:38 AM   #4 (permalink)
NamePros Regular
 
vinodkv's Avatar
Join Date: Feb 2007
Posts: 403
vinodkv has a spectacular aura aboutvinodkv has a spectacular aura about
 



you need mode rewrite....you can use this

Code:
RewriteEngine On 
RewriteCond %{SCRIPT_FILENAME} -f [OR] 
RewriteCond %{SCRIPT_FILENAME} -d 
RewriteRule .* - [L] 
RewriteRule ^index/([^/]+)\.html$ ./index.php?author=$1 [QSA,L]
__________________
Web Design Forum - - Free Web Directory
vinodkv is offline  
Old 02-23-2007, 11:44 AM   #5 (permalink)
NamePros Regular
Join Date: Apr 2004
Location: NL
Posts: 808
Slewey is just really niceSlewey is just really niceSlewey is just really niceSlewey is just really nice
 



Originally Posted by Hitch
Use this, http://www.webmaster-toolkit.com/mod...enerator.shtml
nice tool!
Slewey is offline  
Old 02-24-2007, 08:04 AM THREAD STARTER               #6 (permalink)
NamePros Regular
 
w1ww's Avatar
Join Date: Oct 2006
Location: Mars.
Posts: 439
w1ww is a jewel in the roughw1ww is a jewel in the roughw1ww is a jewel in the rough
 



Hitch, nice tool but I don't know exactly how to work with it!

vinodkv, that code you wrote will rewrite to NAME.html instead of directory, what I specifically want is to

URL: www.website.com/index.php?author=MyName
To be rewrite as: www.website.com/MyName

How to do it ?

Thank you
__________________
:notme:
w1ww is offline  
Old 02-24-2007, 08:42 AM   #7 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,568
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
Originally Posted by w1ww
Hitch, nice tool but I don't know exactly how to work with it!

vinodkv, that code you wrote will rewrite to NAME.html instead of directory, what I specifically want is to

URL: www.website.com/index.php?author=MyName
To be rewrite as: www.website.com/MyName

How to do it ?

Thank you
That's basic rewriting, try something like this:

Code:
RewriteEngine on
RewriteRule ^([^/.]+)/?$ index.php?author=$1 [L]
([^/.]+) means we should find and store (in $1) any character but a period of forward slash
????: NamePros.com http://www.namepros.com/programming/297796-htaccess-questions.html

/? is used to let users add a forward slash at the end of the url, with or without it will work

The [L] flag means if the rule is successful then do not check any more (optional)

Matt
Matthew. is offline  
Old 02-24-2007, 08:50 AM THREAD STARTER               #8 (permalink)
NamePros Regular
 
w1ww's Avatar
Join Date: Oct 2006
Location: Mars.
Posts: 439
w1ww is a jewel in the roughw1ww is a jewel in the roughw1ww is a jewel in the rough
 



It works, thank you Matthew!

What if I wanted my start page to be in a directory like /site/ withou having to redirect the user?
__________________
:notme:
w1ww is offline  
Old 02-24-2007, 08:58 AM   #9 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,568
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
Originally Posted by w1ww
It works, thank you Matthew!

What if I wanted my start page to be in a directory like /site/ withou having to redirect the user?
Not sure what you mean by that exactly however if you wanted to change the url from /MyName to /site/MyName then simply change the rule to this:

Code:
RewriteRule ^site/([^/.]+)/?$ index.php?author=$1 [L]
Matt
Last edited by Matthew.; 02-24-2007 at 12:47 PM.
Matthew. is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:54 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger