Welcome Guest, Not a member yet? Register   Sign In
URI
#1

[eluser]nuttynibbles[/eluser]
hi, i've got a profile page. what i did was do a profile controller, created a view function which retrieve info for the display of user profile. so my url will be http://domain.com/profile/view/username.

i've seen other webpage whereby the url is simply http://domain.com/username. how do i go about this??
#2

[eluser]GSV Sleeper Service[/eluser]
using routes
#3

[eluser]nuttynibbles[/eluser]
will it work if i'm using a sub domain currently. it's in development stage
#4

[eluser]nuttynibbles[/eluser]
my url is http://dev.domain.com
the link i wanna route is http://dev.domain.com/profile/view/123
i did $route['user/(:num)']='profile/view/$1' but it did not work. it gave me a blank page.

is there something i missed?
#5

[eluser]Tom Schlick[/eluser]
is 123 a username? or an ID? like are you trying to route something.com/bob to something.com/profile/view/248? if so you will have to do some queries on your db to get the id of the user.

try taking a look at this page...
http://ellislab.com/forums/viewthread/85290/

it really helped me out doing this
#6

[eluser]nuttynibbles[/eluser]
okay tks i take a look..
#7

[eluser]huzzi[/eluser]
This may help http://ellislab.com/forums/viewthread/60672/
#8

[eluser]asim111[/eluser]
Try This:

Code:
$route['(:num)'] = "profile/view/$1";

in .htaccess

Code:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Tested:

To convert

http://www.domain.com/profile/view/userid

into

http://www.domain.com/view/userid

Code:
$route['view/(:num)'] = "profile/view/$1";
#9

[eluser]nuttynibbles[/eluser]
hi asim111, i tried yr method but to no success.

here are the content in my htaccess file:
Code:
Options -indexes
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1/ [L]
<Files *.jpeg>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>


im not sure if the htaccess does affect the routing.
#10

[eluser]nuttynibbles[/eluser]
managed to resolve the problem.. basically i got the wrong segment in profile/view.

it should be $this->uri->segment(2) and not $this->uri->segment(3)




Theme © iAndrew 2016 - Forum software by © MyBB