redirect problem |
[eluser]amalik[/eluser]
[code]Hi, I am creating a website where I want my users to be able to create a portfolio if they use the following url www.mywebsite.com/amalik rather then www.mywebsite.com/portfolio/amalik. I used the _remap() function but not luck. Can anybody help please. Thanks in advance. amalik
[eluser]Unknown[/eluser]
Hi, Check URI Routing in the user guide. You can configure your own routing rules by modifying the application/config/routes.php file. Regards, Anders
[eluser]amalik[/eluser]
Hi Anders, Thanks a lot for your reply. I am new to CI so I am a bit unsure. In routes.php I specified the default controller to look for the main class name which is home. How can I change it so I can pass a variable to the index() function available in the home class. Thanks in advance. amalik
[eluser]Mauricio de Abreu Antunes[/eluser]
[quote author="amalik" date="1329296497"]Hi, I am creating a website where I want my users to be able to create a portfolio if they use the following url www.mywebsite.com/amalik rather then www.mywebsite.com/portfolio/amalik. I used the _remap() function but not luck. Can anybody help please. Thanks in advance. amalik[/quote] Code: $route['(:any)'] = 'portfolio/$1'
[eluser]amalik[/eluser]
Hi Mauricio, Thanks a lot for your help. That's working fine but only one problem I have many other functions and classes performing different tasks. Now after I implemented it its redirecting all my functions calls to the portfolio page for example if I try to go to the following page www.mywebsite.com/contact_us its redirecting me to portfolio page. Can you please help me how can I only redirect requests for the portfolio page to the portfolio/amalik page. Thanks for your help in advance Thanks amalik
[eluser]Mauricio de Abreu Antunes[/eluser]
Ok. I dont know how to do this, but. In your apache config (httpd conf), your index page is "index.php", right? I think you need to change it for "portfolio.php". And change the route config. Code: $route['portfolio/(:any)'] = '/$1' Any help?
[eluser]amalik[/eluser]
Thanks for your reply. Just to explain my self I have a home class and that is my default controller. Home class have an index() function. By using this index function I am outputting the www.mywebsite.com page. I have another class that is called portfolio in that class I am using _remap() function to show the portfolio of the user when they enter www.mywebsite.com/portfolio/amalik. I want to some how make index page take a variable and try to search existing portfolio names if available then show the portfolio page if not then continue with the other functions. Thanks, amalik
[eluser]monkeycymbal[/eluser]
[quote author="amalik" date="1329296497"][code]Hi, I am creating a website where I want my users to be able to create a portfolio if they use the following url www.mywebsite.com/amalik rather then www.mywebsite.com/portfolio/amalik. I used the _remap() function but not luck. Can anybody help please. Thanks in advance. amalik[/quote] Same scenario here. If I understand correctly, mywebsite.com/username and mywebsite.com/portfolio/username should load same page. I think that the only way is to use htaccess url masking, so mywebsite.com/username act as mywebsite.com/profile/username and at the same time you can continue to refer to "profile" controller, in your code. Ideas?
[eluser]Mauricio de Abreu Antunes[/eluser]
Nice topic! I'm curious about the resolution...
|
Welcome Guest, Not a member yet? Register Sign In |