Reply
Fixing URL's
Old 10-19-2005, 11:09 PM Fixing URL's
Average Talker

Posts: 21
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
 
When You Register, These Ads Go Away!
Old 10-20-2005, 03:23 AM
Cagedweb's Avatar
Extreme Talker

Posts: 170
most sites keep it as an underslash for a name like chris_rudd, users will be used to something like this.
Cagedweb is offline
Reply With Quote
View Public Profile Visit Cagedweb's homepage!
 
Old 10-23-2005, 01:07 PM
Skorch's Avatar
Super Talker

Posts: 115
Location: California
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 Cliff Diving website!
Skorch is offline
Reply With Quote
View Public Profile Visit Skorch's homepage!
 
Reply     « Reply to Fixing URL's
 

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

vB 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.64146 seconds with 12 queries