Magento - Multi store rewrite - url change - .htaccess

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).

Related

can't add shop in store.shopware.com - wrong url

screen from store.shopware.com - wrong url
I want to add SW shop to store.shopware.com
url shop which I wanto to add is https://remiza.com.pl/sklep
and I can't because of "The specified domain is invalid" - look at the screen
I try add https://remiza.com.pl/ (there is only a splash page where users can choose WP site and SW shop) https://remiza.com.pl/sw-domain-hash.html and then I could add but problem is that I can't f.e. use support for that - there are no SW shop on https://remiza.com.pl/
How can I add shop which is in subfolder ?
On the Shopware Cloud documentation no support for sub folders is mentioned.
It is a bit unclear what you are trying to accomplish. But if you change the IP of remiza.com.pl to the Shopware Cloud IP, you should be able to use this direct domain for the shop.
If you are trying to have another site (for example WordPress) on "/" and your Shopware cloud store on a subfolder, this cannot work out of the box, as the full domain needs to point to the Shopware cloud server. If this is the setup you are looking for, a proxy solution might help - but it would be much easier to accomplish with a subdomain.

How to remove default code from url in magento

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

Website A 'redirect' to subdomain of website B, with content of website A

There has been a question made towards me recently to do the following:
We have a website with Drupal running in IIS.
On that site is an URL Redirect to a website hosted externally, obviously with a name completely irrelevant to the name of our company.
The question now is the following;
They want to change to URL to a subdomain of our website. Example: from "www.external-site.com" to "www.sub.internal.com" (while still showing content of the external website)
They want the current page of that website to be reflected in the URL bar. So it wouldn't say "www.sub.internal.com", but it would say "www.sub.internal.com/solutions/page1.html" (instead of "www.external-site.com/solutions/page1.html")
It's possible that I forgot another 'condition' but have mentioned before this.
So, if someone visits through our URL Redirect to External-website, it needs to show our subdomain instead of their domain in the URL, AND it needs to show the current page when people start browsing while still using our subdomain in the URL.
Now, I checked the external-website, and it seems that most of the links available are relative links (if this would be any useful information).
Currently, the external website is hosted externally, and will remain to be so for next few years. (I believe we bought the company)
I have been asking around and looking up, and the best possible thing seems to use domain forwarding, but even then it still doesn't seem to comply with the entirety that they asked of me.
I am but a 'simple' .NET programmer, held responsible to do support for anything involving the websites, and I can't say I have extended knowledge about infrastructure. (But I can ask people to do this for me)
Is there anything that could solve this?
Thanks so much!
IIS's URL rewite and Application Request Routing (ARR) combo can help you what you want to achive. Here are few links which may guide you to configure ARR. Please note that these links dont exibit exact solution to your problem however you can take clue from it and fabricate your solution accordingly.
http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing
http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-rule-template
It sounds like you'll want to use a full-page iframe: do not redirect but show a page with an "inner page" instead: that inner page is the external web site. That way, users do not see the external site in their URL bar.
http://webdesign.about.com/od/iframes/a/aaiframe.htm
You need to configure the equivalent of Apache Virtual Host with Reverse Proxy on IIS.
See this answers:
https://serverfault.com/a/271030
and
https://stackoverflow.com/a/10003306/2131693

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.

SharePoint - provisioning url properties through CAML?

Is there a solution to the following that I am missing in SharePoint/CAML. Note that I'll give a specific example of using a URL on a Redirect Page (publishing feature content type), but the issue is broader in scope than provisioning a Redirect Page. It is really a question anywhere a "URL" field/property can be set (web parts, pages, etc).
Like most SharePoint developers, I have a set of environments: "DEV", "QA", "STAGING", and "PROD". I have a few "locale" specific sites in each environment:
www.mysite.com
us.mysite.com
uk.mysite.com
etc...
Sites in each environment, other than PROD, have an environment prefix associated with them, for example:
us.dev.mysite.com
us.qa.mysite.com
us.staging.mysite.com
Probably a pretty common setup...
I have a need to redirect users to a page that only exists on the "www" site from each of the locale specific sites. I need the redirect to redirect users to appropriate "www" site for the environment they are currently in. For example, if I am in dev in the uk locale, and I visit the redirect page, I should be redirected to the www dev site.
I was hoping to use a "Redirect Page" from SharePoint to accomplish this. I was going to setup a feature (with module elements) to provision an instance of the "Redirect Page" content type. This allows me to specify a url to redirect users to. If I am provisioning the page through CAML, however, I need a way to ensure the redirect is appropriate for the environment being specified. I cannot trust myself, or other devs, to remember to change the URL each time we build and deploy the wsp to each environment.
Is there anyway in SharePoint/CAML to do some sort of token replacement based on some switch when specifying field/property values?
I'm not sure I understand you requirements entirely, but for the variance of environments (Dev, QA, Staging, Prod), I would use Chris O'Brien's 'Config Store' feature:
http://www.sharepointnutsandbolts.com/2008/05/introducing-sharepoint-config-store-for.html
This will create a simple list where you can store infomation specific to the current environement.
This combined with Gary Lapointe's stsadm extentions:
http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html
You can use this to push out the correct values per environment to your 'Config Store' and in your code, query the 'config store list' for the environment value.
For sites that represent different countries, you can vary them on the regional settings property for that site/site collection/web. This adds another dimension to check in your code.
In your case, you may have entry in the config store called 'MyPrefixUrl' and call its value + relative path to redirect the user to the correct place.
Hope this doesn't confuse you.

Resources