How to create our profile url |
[eluser]JasmineFlower[/eluser]
Hi, I followed your instruction to create a hook. but now i used local host server.. my folder name : projects my codeigniter folder name : example In my database table - user - have username & user_urlname fields. for ex: username : jasmine, user_urlname: flower (created by user) so i need url like this -> localhost/projects/example/flower In my htaccess file having : Code: RewriteEngine on In my hooks, Code: $this->uri =substr($_SERVER['REQUSET_URI'],1); In $this->uri gives the result = /projects/example/flower. but my database field user_urlname having data - flower. how can i check by using query ? suppose i change second parameter for the above code like this Code: $this->uri =substr($_SERVER['REQUSET_URI'],18); now the if condition is true but 404 error raising. I don't know what mistake i made in that code, pls tell me to correct that error
[eluser]toopay[/eluser]
Above class expected the first segment uri (after trailing slash) as user_url, and then if the condition match, it will told CI to re-route the requested uri to the '/user/index/id', which cause 404 error in your localhost environment! I think, its best practice to set your development environment, as close as possible with 'live' environment. It will avoid errors like you stated above. I mean, first, you must have accesible url like 'local.yoursite.com' in your local computer.
[eluser]toopay[/eluser]
If you don't know how to do that, here the quick way. 1. If you're using windows, first you must add your host name in 'C:\WINDOWS\system32\drivers\etc\hosts'. Open 'hosts' file, then add 1 line Code: # Copyright (c) 1993-2009 Microsoft Corp. Code: <VirtualHost *:80> 4. Change your htaccess to Code: RewriteEngine On Code: $route['admin/(:any)'] = "admin/login";
[eluser]JasmineFlower[/eluser]
hi toopay, Thank u so much. its working... suppose if i change my domain name , i must change the system files..s correct once again thank u
[eluser]JasmineFlower[/eluser]
Hi, I found another way without changing system config & server config files. In my hooks file userlookup.php as below Code: <?php
[eluser]frozenmaiden[/eluser]
I try your solution and it work well in sub domain, but why it raise 404 error on main domain? For example i have http://test.com and http://shop.test.com i want if people access http://test.com/myprofile it will redirect to http://shop.test.com/myprofile and http://shop.test.com/myprofile will redirect it to their user profile. hooks in http://shop.test.com/myprofile works like a charm, but hooks http://test.com/myprofile raise 404 errors. T_T Code: $_SERVER['REQUEST_URI'] = '/p/r'.$_SERVER['REQUEST_URI']; i try to change all that server variable,but nothing to change,please help.. EDIT: I solve the problems by myself, but get strange solution.. I change $config['uri_protocol'] on http://test.com to QUERY_STRING and it work perfectly. That make me confuse,because on http://shop.test.com i set $config['uri_protocol'] to AUTO, and no problems at all.:-S NOTE: http://test.com and http://shop.test.com each have their own CI.
[eluser]Amitabh Roy[/eluser]
It would be great to know if anybody have taken this a step forward and have implemented the following Code: http://www.example.com/username etc , which should pull up the data for the relevant function(feedback,contact,products) for the given user(username) |
Welcome Guest, Not a member yet? Register Sign In |