How to remove default code from url in magento - .htaccess

In my Magento I've created two store so we have now these stores:-
commercial and url :- www.mysite.com/commercial
default and url www.mysite.com/deault
retail. and url www.mysite.com/deault/retail
My commercial url looking good but I want to remove default from these stores :-
deault and url www.mysite.com/deault
and
retail. and url www.mysite.com/deault/retail
If I disable :"Add Store Codes" to Url = no then commercial stores stops working.

Here's an explanation for how to do it:
http://www.crucialwebhost.com/kb/how-to-setup-multiple-magento-stores/#subdirectory-method
Basically you need to manually create the subdirectories and put modified copies of the files index.php and .htaccess inside.
But this assumes that you run the 'default' shop directly on the domain top level directory. Another Stackoverflow post that could give insight into the settings:
Multiple magento stores on single domain

Related

Magento - Multi store rewrite - url change

I have a Magento website that is running in production environment for a year now.
Now we want to create a Wholesale and retail store in this same installation. We are did that in a test environment and everything works fine.
So, before multistore created, we had our URL example.com.
Now, we are using different websites, setting "Add Store Code to Urls" to YES, so we have:
Retail: example.com/default
Wholesale: example.com/wholesale
However, my URL's will be "broken" when someone search for it on Google. Is there a way to set up when someone try to access a URL without store code, to add the "default" code (for retail store)?
You may solve this using .htaccess / virtual hosts combined with magento run code. There are many resources with in depth articles (like the first google result I got).

Redirecting using .htaccess

I've got an odd redirect request, and I'm not sure if it is possible.
On the server we have a series of PHP files with a name similar to /title-of-the-page-####.php, where #### is an unique integer ID of the page.
I want to be able to redirect users from /#### to the full title of the page (as listed above). Is this possible from within an .htaccess file, and if so, how? (I would like to avoid listing all of the pages from within the .htaccess file)

Magento - Multi Website Setup

I am having configuration settings with my multi website magento setup.
I have a website running at abc.com . Now for international storefront I have created another website, store view and store with abc_international as the website code.
In my configuration, I have configured Base URL as abc.com/int/
However, when I access the URL abc.com/int/ it generates a 404 error.
Another important point is even if I specifically make changes in index.php as follows -
$mageRunCode = "abc_international";
$mageRunType = "website";
Mage::run($mageRunCode, $mageRunType);
Any ideas as to what might be the problem.
You need to copy index.php and .htaccess files to abc.com/int/ at server and provide particular path to Mage.php file at index.php which is inside abc.com/int/ and in that index.php file you need to modify Mage::run($mageRunCode, $mageRunType); to Mage::run("abc_international", "website"); then it will work if you properly configured multi-website setup.

Magento .htaccess Removal of index.php from Store Urls

I do not want my URLs on my Store to contain index.php. All my product pages can be accessed via addition of index.php and without it which is not good and I want to get rid of index.php from the urls.
For example, both of these urls display the same content, but I only want users to ever be directed to the second URL:
http://www.pudu.com.au/index.php/outback-mens-denim-cargo-shorts.html
&
http://www.pudu.com.au/outback-mens-denim-cargo-shorts.html
Likewise for content at the top level of the site:
http://www.pudu.com.au/index.php
&
http://www.pudu.com.au/
Magento adds the system endpoint (index.php) to the URL path based on a configuration setting. In the admin, navigate to System > Configuration. In the Web section, open the Search Engines Optimization group and set Use Web Server Rewrites to "Yes". You'll need to flush the configuration cache and redindex URL rewrites thereafter.

Custom URL in Codeigniter using htaccess

I am developing a site on Codeigniter 2.0.2 . Its a site where companies/users can signup and create their own profile page, have their own custom url(like http://facebook.com/demouser), have their own feedback system, display their services.
This said, I have been successful in display the profile page in the following format
http://mainwebsite.com/company/profile/samplecompany
This displays the home page for the company samplecompany , where company is the controller and profile is the method.
Now I have few questions,
I guess it is possible to create to have/get http://mainwebsite.com/samplecompany using htaccess and a default controller. If anybody can help with the htaccess rule , that would be awesome. I am already using htacess to remove index.php from CI but could not get this working.
There will be few other pages for the given user/company such as feedback, contact us, services etc. So the implementation links that come to my mind is of the form
`
http://mainwebsite.com/company/profile/samplecompany/feedback or
http://mainwebsite.com/samplecompany/feedback
http://mainwebsite.com/company/profile/samplecompany/services or
http://mainwebsite.com/samplecompany/services
http://mainwebsite.com/company/profile/samplecompany/contactus or
http://mainwebsite.com/samplecompany/contactus
wheresamplecompany` is the dynamic part
Is it possible to create site links in the format?
I understand using A record for a given domain, I can point a domain say, http://www.samplecompany.com to http://mainwebsite.com/company/profile/samplecompany so typing http://www.samplecompany.com he should be taken to http://mainwebsite.com/company/profile/samplecompany . If this is successfully implemented, will
http://www.samplecompany.com/feedback
http://www.samplecompany.com/services
http://www.samplecompany.com/contactus
work correctly?
I guess it is possible to create to have/get http://mainwebsite.com/samplecompany using htaccess and a default controller. If anybody can help with the htaccess rule , that would be awesome. I am already using htacess to remove index.php from CI but could not get this working.
There will be few other pages for the given user/company such as feedback, contact us, services etc. So the implementation links that come to my mind is of the form ` http://mainwebsite.com/company/profile/samplecompany/feedback or http://mainwebsite.com/samplecompany/feedback
You can accomplish this using routes. For example, in your /config/routes.php file, put this:
$route['samplecompany'] = "company/profile/samplecompany";
$route['samplecompany/(:any)'] = "company/profiles/samplecompany/$1";
The first rule tells CodeIgniter that when someone accesses http://mainwebsite.com/samplecompany that it should process it as if the URL were "company/profile/samplecompany". The second rule captures anything that comes in the URI string after "samplecompany" and appends it onto the end.
However, if you have multiple companies(not just samplecompany), you're probably going to want to extend CI's router to suppor this unless you want to manually edit the config file each time a new company is added.
OK, you're definitely going to want to handle dynamic company names(as per your comment). This is a little trickier. I can't give you the full code, but I can point you in the right direction.
You'll want to extend CI's router and on an incoming request query the DB for the list of company names. If the URI segment matches a company name, you'll want to serve it up using your company/profile method. If it does not, you will ignore it and let CI handle it normally. Check out this post on this topic for more information: forum link.
Here's a great guide on how to achieve what you need: Codeigniter Vanity URL's.

Resources