magento custom url rewrites to .html for cms pages - url

I am moving an ecommerce site into magento and would like to preserve as many indexed links as possible. For example: the about page's url is domain.com/about.html. Magento writes the url as domain.com/about. If I add a custom rewrite and force the .html to be re-written to the end I get a 404 page not found error.
Is what I am trying to do possible? I have also tried re-indexing the store and that did not help.

If you can make a small module, you can use the cms_controller_router_match_before event, dispatched in the Mage_Cms_Controller_Router class, to handle the .html suffix in the URL keys of the CMS pages (by removing it when it is present in the identifier passed in the condition object).
Otherwise, you can get almost the same result by adding .html at the end of the URL keys.

Related

Umbraco URL issue with Vorto

I am using vorto plugin in my Umbraco 7 application to achieve the multilingual capability.
I mentioned the URL in hostname as 'localhost/clientname/en'.
Whenever I open login page the URL which is getting form is 'http://localhost/clientname/en/login'.
This is the structure of vorto URL writing.
But can I achieve it like 'http://localhost/clientname/login/en' ???
I want language names at the end of the URL, not in between.
Is it possible ?
Please help....i am badly stuck in my project task !
It sounds like you need a custom URL provider, setting the domain to 'localhost/clientname/en' will mean that the URLs will always get added AFTER the language part as the host is always the first part of the URL.
Have a look at this article on URL providers and content finders: https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/ it's quite old, but it should still work. That should give you an idea of how to make it work. Basically you want the URL provider to append the language to the end of the URL, and the content finder to strip the language from the end and then find the actual content. You can also then set the language of the current thread in the content finder so that Vorto and Umbraco are using the correct language based on the URL.

Different Content/Style in Multitenant Application

What is the preferred way to go for creating a multi-tenant application with angular 4 (or above) as frontend?
I want tenant-specific content to be served via an API (like the stylesheet or a tenant-specific header/navigation) and store it in a database.
Currently, I use aspnetzero but I am stuck with the custom stylesheet. The Css is available at an Url from the backend (aspnetzero) and I get this Url from my abp session. But how do I link this css file without getting FOUC (flash of unstyled content)? Currently, I just use the link tag and set href to an angular-component variable that stores the url to my css file (it is set in ngOnInit). But then i get FOUC.
Maybe my whole architecture is wrong in my attempt. I am definitely open to entirely different approaches!

How to configure a site so that I can have a url without directory the way Wordpress did?

Say I made a website with Wordpress, and created a few pages say www.foo.com/bar1 and www.foo.com/bar2. I have no idea where they stored this, since there is no /bar1 and /bar2 directory. Unlike when I created a site from scratch and added new directories like /public_html/bar1.
So how do I configure it like this without Wordpress?
It depends on the technology\framework you're using. Google 'Routing'.
Example for Asp.Net: https://msdn.microsoft.com/en-us/library/cc668201.aspx
When you create a page using WordPress, your all page will have a dynamic content with same layout from page.php file which is a mandatory file of a theme and served according to the routes. You will not see the page.php in URL or page. WordPress saves your page title in database and servers it accordingly (check the permalink section of WordPress).
When you create a custom site from scratch you can do the same by creating a file and re-use it according to the routes. You don't need directory for that.
Note: File extensions like .php .html are removed using .htaccess file.
Maybe you can use a framework like ZK framework to create a div content and refresh it according to the request. This way, you may not have to update any url in your application. You just refresh an inner div by dynamicaly including a new view.
Maybe this would help:
https://www.zkoss.org/wiki/ZK_Component_Reference/Essential_Components/Include

Does .html in the end of a URL mean that the webpage is static?

I know it's not a good question to ask, but sometimes I really need to know if a webpage or website is static or not.
Sometimes I see .html extension in many URL, Does that mean that those pages are static?
.html extension means that page contains only front-end code and does not have any server side language included in it (I'm not talking about URL rewriters that adds .html to the end of virtual path).
This does not prevent these things:
Page can load it's content via Ajax depending on inputs, URL params, time of day, etc.
Page can be generated as static HTML page, but still be re-generated from time-to-time.
You can have iFrame in static HTML page that leads to .php file.
Not really, .html does not mean webpage is static. Ajax can be used to load dynamic data in html page.
Also there is no proper method defined to find whether page is static or dynamic.
One way is, you can check requests in Developer Options of browser.
You can read more here.
No.
There is no guarantee of a direct relationship between a thing that looks like a file extension in a URL and how the server handles things behind the scenes.
It might be resolved using basic static file handling rules to a static file with that name.
It might use a tool like mod_write to map the URL onto a server side script with the same name but a different file extension (e.g. if the site used to be made of static files, but was changed to be dynamic with steps taken to keep the URLs unchanged).
It might use a tool like mod_write to map the URL onto a server side script that has no relation to the name of the file but implements the front controller pattern for the whole site.
It might map onto a server side script which looks at the end of the URL to determine what type of data to return the content in (e.g. cars.html and cards.json might both be be handled by the same script, which outputs a list of cars, but it might output it in JSON or HTML depending on the URL).
It might hit a 404 error or a 302 redirect.
It might do any number of other things.
Not always, sometimes it can be a generated page from a Servlet or a PHP script that generates them. you can have a .htaccess rule to add .html to all documents.

Spring MVC: url passing variable page style not working

I am using spring mvc for my app. So far everything is going all. However, when I get to a page that has a variable in the url (ie, /edit/{id}), the style doesn't work on that page. In addition when I submit the form on that custom path page and try to go to another page (from the controller using the ModelAndView), the style doesn't work on that destination page which is weird cause the style works fine on that when I access it from elsewhere.
I think the reason the style is not working on the destination page is because the url still stay at the custom path with the url passing variable (localhost:8080/app/edit/5).
Late answer, but I've just experienced this myself and am having a few issues. As far as style sheets or JS files (basically any static resource) not being found after using a path variable, I was able to fix that by prefixing all of my style sheet or JS file links with ${pageContext.request.contextPath}. This ensures that the server always searches for them from WebContent, rather than from the offending path variable. I am also now having the issue of not being able to send proper requests to the other pages, but as my controllers only return Strings for the view resolver rather than ModelAndView objects, I'm not sure your solution will fit for me.

Resources