Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 10-20-2005, 12:09 AM Fixing URL's
Average Talker

Posts: 21
Trades: 0
Hey,

the way I did profiles on my site is like index.php?id=member&user=Username

well now there is a problem...when the user has a space in their name, it messes up the url with the %20 like index.php?id=member&user=User%20Name

I think this would involve mod_rewrite or something like that, but how would I go about keeping it like so: index.php?id=member&user=User Name
its not the biggest deal, but for some it may be hard to read the username in the url bar...
dcahrakos is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-20-2005, 04:23 AM
Cagedweb's Avatar
Extreme Talker

Posts: 170
Trades: 0
most sites keep it as an underslash for a name like chris_rudd, users will be used to something like this.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Cagedweb is offline
Reply With Quote
View Public Profile Visit Cagedweb's homepage!
 
Old 10-23-2005, 02:07 PM
Skorch1's Avatar
Super Talker

Posts: 115
Location: California
Trades: 0
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule bin/(.*)/(.*)/(.*)$ /folderinroot/$3?id=$1&user=$2
I used it so href="bin/value1/value2/page.php" was a valid link. page.php must exist where you specified in your .htaccess file. change or delete 'folderinroot/'

The first instance of $ is end match string. Match string starts at 'bin/'.
The symbol $ denotes start and the numeral specifies which group of brackets of the rewritten url.

The leftmost group is $1. The (.*) sequence means match any charactor, there are other ways to more selectively choose which charactors to match. Any charactor that appears outside of of the bracket is a literal match.

You also might notice that you need to use
PHP Code:
$url=$_SERVER['REQUEST_URI'followed by 
explode
("/",$url)

"SELECT * FROM * WHERE id=$url(1) AND user=$url(2)" 
RewriteRule /(.*) (.*)/$ /$1_$2/

If mod-rewrite is capable of 'matching' a blank space that would replace it with a '_'
__________________
Check out my
Please login or register to view this content. Registration is FREE
website!
Skorch1 is offline
Reply With Quote
View Public Profile Visit Skorch1's homepage!
 
Reply     « Reply to Fixing URL's
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19102 seconds with 12 queries