Codeigniter URL routing - codeigniter

After searching a lot around, I decided to post this matter here.
I am working with codeigniter ( latest release). I need to have the URLs of my site working like below.
[username] / [controller] / [action] / [parameters]
as you can see the username is leading on the URL rest follows as normal. I need to fetch the username and get some data for the site so that that site could be customized according to his settings.
I tried to achieve this with .htaccess but had no luck. Then I checked with routing on code igniter, but I am not sure whether it's the right solid solution for me. can someone give me any leading on this. is this possible ?
Thanks

I would advise to use the routing option from Codeigniter.
http://codeigniter.com/user_guide/general/routing.html
$route['(:any)/user/viewprofile/(:num)'] = controllername/functionname/$2";
This way you can build classes and functions in an nicely ordered way.And keep it in codeigniter.

$route['(:any)/controller'] = 'controller/users/$1';
This will pass the dynamic username to the controller

Related

How to Redirect urls after index.php in Laravel

We have a classified website developed in Laravel Framework. After analyzing the url structure I am getting the following issue:
Original Url: https://in.mysite.com/female-clothes/mycity
Duplicate Url: https://in.mysite.com/index.php/female-clothes/mycity
Every url is being duplicated as per the example given above.
Please let me know how to fix the above issue.
I think best option would be to 301 redirect Duplicate url to the Original url.
Please let me know the htaccess rule to fix the issue.
Do you know which version of laravel?
From what you've said this could be happening in the server (htaccess) or the application (laravel).
Laravel is able to handle url manipulation and redirection. The routing logic is usually found on the file called web.php (router.php for older version). It seems that the string 'index.php' is being inserted in the middle of your urls so look for it there.
If it's not happening in Laravel it could be in the htaccess, so look there as well.

how to make sub folder for login page and rest of the pages in codeigniter

I am working in a codeigniter project in wamp server.
My current login page is http://localhost/flowers/login and its working correctly (no issue). The rest of the urls are like this
http://localhost/handycheck/admin/dashboard etc
My issue is i need to change the login url like this
http://localhost/flowers/admin/login
&
http://localhost/flowers/providers/login
Its because I have to maintain login form for multiple users.
How can i make this.
Please help me and thanks in advance who helps me alot..
You can do this by adding custom roue in codeigniter routing configuration as follows go to config/routes and add the following entry in this file
$route['flowers/providers/login'] = 'flowers/login';
$route['flowers/admin/login'] = 'flowers/login';
this will redirect the request to the login in flowers controller and if you need to do custom handling for admins and provider you can get the url segments and do custom handling according to user type
I hope my answer would be useful

Add referrer code to url

I need add the url of a wordpress blog a referrer code with this structure:
http://domain/([a-zA-Z]{3}[0-9]{3}/...
The site should work both with and without this code.
If there is I have to use it, store it in session type.
All through plugin so you do not have problems with upgrades or any wordpress plugin.
I also tried to edit the file .htaccess with a custom RewriteRule but nothing.
Ideas? Thanks!
Sorry for bad english!
I think you are trying to reinvent the wheel here, there plugins that gives you affiliate program features so you won't have to worry about url and links.
try some of this plugins: Tag: referral
you can also try this one as it has a good description: Affiliates
With wordpress always check existing plugins when you want to add functionality to your website, there are a lot of plugins that do a lot of things.
Edit: you can create your referal link as domain.com?ref=code and in the website header check for $_GET['ref'] if it exists save the ref in a session variable, if the user gets to register then take the ref value from the session variable. This should work
I opted to install the plugin Rewrite and create rules to manage the referrer.
Thanks anyway!

url routing in codeigniter like wordpress clean url

How to code or achieve this url like wordpress
for example
http://www.example.com/product/view/my-product-sample
is there way to have this url ? any tips tutorial example thank you guys :)
Well, this is already a valid URL without any alteration, calling the controller product, method view with the argument my-product-sample.
However, I think you are looking for routing.
Example:
$route['product/view/(:any)'] = 'products/view_product/$1';
This route is saying: If user requests
product/view/(something)
give them
products/view_product/(something)
As usual, see the user guide for more information.

Can we remove secure login option alone from Magento

Is there way to disable the secure login/registeration/forgot password alone, but all other pages like checkout customer dashboard area can use https but i want to disable secure url for only customer login/registeration/forgot pages, i checked on custome r module /etc/config.xml but couldnot find anything like that.
Please help me
Thanks in advance.
First you'll want to do all this from app/code/local/ of course!
With that being said you'll need to extend/edit app/code/core/Mage/Customer/etc/config.xml:
<secure_url>
<customer>/customer/account/</customer>
</secure_url>
...and remove it.
Next you'll need to edit/extend app/code/Core/Mage/Customer/Helper/Data.php:
and modify the _getUrl()'s to force using secure url on the pages you want it to be secure:
return $this->_getUrl('customer/account', array('_secure' => true));
NOTE: Like everyone else mentioned this isn't exactly a good idea from a security stand point.
Hope this helps!
Did you think that Login pages are accessed via HTTPS for a reason? The reason is to protect them from modification. Removing HTTPS will open a huge security hole and will cause leakage of passwords of your web site visitors.
So, you should overload the blocks that contents url links and rework it to get urls witout http. But the good is to use in your box the iframes.

Resources