[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 02-23-2007, 09:51 AM   #1 (permalink)
NamePros Regular
 
w1ww's Avatar
 
Join Date: Oct 2006
Location: Mars.
Posts: 433
109.50 NP$ (Donate)

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, 10:09 AM   #2 (permalink)
Adrian
 
Hitch's Avatar
 
Join Date: Aug 2005
Location: Uk, South Yorkshire
Posts: 1,227
16.00 NP$ (Donate)

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

Animal Rescue Third World Education Find Marrow Donors!
Use this, http://www.webmaster-toolkit.com/mod...enerator.shtml
__________________
NamePros
Hitch is offline  
Old 02-23-2007, 10:10 AM   #3 (permalink)
Domains my Dominion
 
sdsinc's Avatar
 
Join Date: Aug 2005
Location: Web 1.0
Posts: 6,284
1,095.94 NP$ (Donate)

sdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond repute

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
What you need is mod_rewrite instead.
__________________
Buy now - MassDeveloper.com $500
sdsinc is offline  
Old 02-23-2007, 10:38 AM   #4 (permalink)
NamePros Regular
 
vinodkv's Avatar
 
Join Date: Feb 2007
Posts: 403
190.75 NP$ (Donate)

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, 10:44 AM   #5 (permalink)
NamePros Regular
 
Join Date: Apr 2004
Location: NL
Posts: 827
316.85 NP$ (Donate)

Slewey is just really niceSlewey is just really niceSlewey is just really niceSlewey is just really nice


Quote:
Originally Posted by Hitch
nice tool!
__________________
xmpv.com | nuwp.com | frot.info |
Slewey is offline  
Old 02-24-2007, 07:04 AM   #6 (permalink)
NamePros Regular
 
w1ww's Avatar
 
Join Date: Oct 2006
Location: Mars.
Posts: 433
109.50 NP$ (Donate)

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, 07:42 AM   #7 (permalink)
Stud Sausage
 
Join Date: Dec 2006
Location: England
Posts: 1,546
34.41 NP$ (Donate)

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
Quote:
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

/? 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
__________________
My NamePros Tools
(firefox plugin, google gadget etc)
Matthew. is offline  
Old 02-24-2007, 07:50 AM   #8 (permalink)
NamePros Regular
 
w1ww's Avatar
 
Join Date: Oct 2006
Location: Mars.
Posts: 433
109.50 NP$ (Donate)

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, 07:58 AM   #9 (permalink)
Stud Sausage
 
Join Date: Dec 2006
Location: England
Posts: 1,546
34.41 NP$ (Donate)

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
Quote:
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
__________________
My NamePros Tools
(firefox plugin, google gadget etc)

Last edited by Matthew.; 02-24-2007 at 11:47 AM.
Matthew. is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 10:33 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85