We are using the Hybris platform, and our products URL are like below.
I am new to Hybris platform but I know about URL structure, and I think something is going wrong here. I've checked other Hybris sites and other Hybris sites have short and clean URLs. Any suggestion?
http://shop.cintas.com/store/site/c/Southport-Skirt/p/11361733?searchText=:price-asc&plpcategoryCode=Eco
http://shop.cintas.com/store/site/Apparel/Headwear/Knit-Cap/p/00013120?searchText=:price-asc&plpcategoryCode=Apparel
You can change the URLs by changing the ProductModelUrlResolver and ProductDataUrlResolver. Hybris uses them to determine the URL for products throughout the system. Keep in mind, that the URL needs to end with the pattern of the ProductPageController "/**/p/{productCode}".
You can replace the bean declaration. There is even some possibility to configure the resolvers via a URL pattern (see attribute "defaultPattern" of ProductModelUrlResolver). However for further adaptions, you need to change the implementation of the classes.
See classes:
de.hybris.platform.commerceservices.url.impl.DefaultProductModelUrlResolver
de.hybris.platform.commercefacades.url.impl.DefaultProductDataUrlResolver
and corresponding beans:
productModelUrlResolver
productDataUrlResolver
See also my post here:
How to normalize URLs in Hybris
These urls generated by Apparel sample accelerator, you can create your own URL Strategy. You need development for it.
Your question is very common... So hard to answer... But for the ProductPageController there is a logic that all sites on
/**/p/{productCode}
Are handled by the ProductPageController. There is a logic that pages ends with /p/{productCode} will handle the request and replace the front part with the name of a product,...
Mabye this helps you and you can more specify your question?
BR
Related
I was visiting the site asos.com the other day. If you search 'tshirt' on their site the resulting URL is 'http://www.asos.com/search/tshirt?q=tshirt'. Does anyone know which technique they use to make it seem that the live generate a page called 'tshirt' which basically takes any extension?
Also if you select a product the URL becomes something like: 'http://www.asos.com/ralph_lauren/polo/product.aspx' I know they don't have a file and folder for every brand and item, so how is it possible for the browser to follow this url?
I'm not looking for any code, just a hint on what to google for more information.
Hope this doesn't sound too ignorant!
Many Ragards,
Andreas
In most cases, this sort of functionality (often called clean URL's, user-friendly URL's, or spider-friendly URL's), is achieved through server-side rewrites. To point all requests of a specific known structure to a single backend script for processing.
Now these specific URL's you mention are not, in my opinion, the best examples of clean URL's. I will give you an example however of how such a clean URL might be achieved using Apache mod_rewrite (since Apache is so popular).
Take for example a URL like http://somedomain.com/product/ralph_lauren/polo
You might be able to do something like this in mod_rewrite
RewriteEngine On
RewriteRule /?product/(.*)/(.*) /product.php?cat=$1&subcat=$2 [L]
This would silently (to the end user) redirect the incoming request for any URL's of the structure /product/*/* to a script called /product.php, passing the second and third parts of the URL as cat and subcat parameters to be evaluated by the script.
I'm not sure I understand what you are asking, but in the example you cited it's using a query string which is everything after the '?' in the URL.
On the backend server it uses the variables passed in the query string to determine what to return back to you.
I have changed my domain name and i really don't want to go through the trouble of making all the links i have posted in the articles in my website to the domain name. Is there a code i can use to make all the links to the old domain change.
For example, if i have a link somewhere that is oldurl.com/faq
and i want it to change to newurl.com/faq
But without rewriting it manually, so it does it for all the links on my website that start with oldurl.com
How would i do this?
You can point the DNS for the old domain to the new domain, and place a redirect rule in the webserver to rewrite to the proper domain.
This is probably something you should do anyway to have any external links that you have no control over be pointed to the proper new location.
This however is not a substitute for fixing your actual links. You should fix these as well. In fact it is usually best proactice to not include the full URL on internal site links, instead using only URI's or relative paths for such links.
Most any good IDE will give you the ability to search and replace across all file in a site, so doing this should not be too painful.
This is the quick and lazy way to do it.
$(function(){
$('a').attr('href', function(x, url){
return url.replace('oldurl.com', 'newurl.com');
});
});
I would like to hide the webpage name in the url and only display either the domain name or parts of it.
For example:
I have a website called "MyWebSite". The url is: localhost:8080/mywebsite/welcome.xhtml. I would like to display only the "localhost:8080/mywebsite/".
However if the page is at, for example, localhost:8080/mywebsite/restricted/restricted.xhtml then I would like to display localhost:8080/mywebsite/restricted/.
I believe this can be done in the web.xml file.
I believe that you want URL rewriting. Check out this link: http://en.wikipedia.org/wiki/Rewrite_engine - there are many approaches to URL rewriting, you need to decide what is appropriate for you. Some of the approaches do make use of the web.config file.
You can do this in several ways. The one I see most is to have a "front door" called a rewrite engine that parses the URL dynamically to internally redirect the request, without exposing details about how that might happen as you would see if you used simple query strings, etc. This allows the URL you specify to be digested into a request for a master page with specific content, instead of just looking up a physical page at that location to serve.
The StackExchange sites do this so that you can link to a question in a semi-permanent fashion (and thus can use search engines with crawlers that log these URLs) without them having to have a real page in the file system for every question that's ever been asked (we're up to 9,387,788 questions as of this one).
From the article at google's webmaster center and SEO's pdf, I think I should improve my website's URLs structure.
Now the news url looks like "news.php?id=127591". I need to rewrite it to something like "/news/127591/this-is-article-subject"
The problem is if I change the structure of url to the new one. Can I still keep the old one working? If both url working, how to avoid search engine like google and bing to search twice times for one article?
Thanks!
HTTP 301 permanent redirect from the old URL to the new URL
an HTTP 301 redirect has the property of communicate a new (permanent) URL for an old (outdated) ressource to google (and other clients). google will transfer most/all of the allocated value from the old URL to the new URL.
Also, in order to improve the arquitecture of your website, you must keep a clean structure by inserting links within all its pages/posts. But be careful, you must not do this lightly, or Google´s robot will get confused and leave.
Structure is key to your SEO
1. Find one page which is the "really important page" for any given keyword
2. direct relevant content from other pages which is relevant to that particular kw
3. repeat with every relevan kw
I´m gonna leave this post for you, where I explain this more in depth, hoping that you understand spanish. http://coach2coach.es/la-estructura-web-es-la-base-del-posicionamiento/
Yep.. you can use robots.txt to exclude news.php, and create an xml sitemap with the new URLs. mod_rewrite can be set to only change directories, with trailing slashes.. so all files in your root directory should work fine.
I am trying to implement Twitter's OAuth into my Code Igniter web application at which the callback URL is /auth/ so once you have authenticated with Twitter you are taken to /auth/?oauth_token=SOME-TOKEN.
I want to keep the nice clean URL's the framework provides using the /controller/method/ style of URL but I want to enable query strings as well, there will only ever be one name of the data oauth_token so it's ok if it has to be hard coded.
Any ideas?
I have tried tons of the things people are saying to do, but none work :(
PS: I'm using the .htaccess method of URL rewriting.
There are several ways to handle this.
Most People, and Elliot Haughin's Twitter Lib, extend the CI_Input library with a MY_Input library that sets allow_query_strings to true
You will also need to add ? to the allowed characters in config/config.php and set $config['url_protocal'] to PATH_INFO
see here: Enable GET in CodeIgniter
Codeigniter Reactor lets you access $_GET directly or via $this->input->get(). You don't need to use MY_Input or even change your config.php. This method leaves the query string in the URL, however.
I used a hacked index.php to recognise users coming back from Twitter, check for valid and safe values, then re-direct it to to a CodeIgniter friendly URL.
It may not be to everyones taste but I preferred it over allowing query strings throughout the entire application instead of just one particular circumstance.