Is there a way to create / process friendly URLs in liferay like this?
http://myserver.com/JonDoe
... where John Doe is the name of a clients whose data should be displayed.
A little more detail:
I am not talking about getting rid of the "web" or "group" for friendly urls, I am taking about having a friendly url right after the first "/".
We want to create URLs in the form of http://server/ClientName where ClientName resolves to the name of a Client. This is an issue since normally liferay would expect a friendly URL after the first "/". So we ned to intercept that somehow.
The process should be like this (pseudo code):
1) inspect values after first "/"
2) If value after "/" is the name of a client, send user to client display page and display client information
3) If there is no client with the given name, interpret it as friendly url and do normal liferay behaviour.
Is there a way to do this in liferay ?
Sounds like you want to get rid of the /web/ or /group/ parts of the URLs? This is possible with proper configuration of the virtual host - you'll map the site to the domain name, then you have total freedom to name the pages, even hierarchically (e.g. /JonDoe/home)
So far this was simple configuration. If you want /JonDoe to point to another site than /JoeShmoe (e.g. just get rid of /web/ or /group/), you'll have to dig deeper and write quite some customization plugins that change the name resolving (and generation of URLs)
If you want to have one URL for a page, you can just set the friendly URL for that page (see Olafs remark about virtual hosts as well)
If you want to have a limited set of URLs for one page, you can create a page of type Link to Page for each URL and select the original page. To identify the current URL when rendering you portlet you can use PortalUtil.getCurrentURL(renderRequest)
If you want to have many URLs for one page you could use a FriendlyUrlMapper, which allows URLs like http://myserver.com/page/-/myPortlet/JonDoe.
If you want to have many "root" URLs (i mean without the /page/-/myPortlet part), you will have to create an Liferay EXT plugin, extend com.liferay.portal.util.PortalImpl and overwrite getPortletFriendlyURLMapperLayoutQueryStringComposite. I've done the same by implementing a strategy that checks if a page exists for a specific given URL and otherwise uses the URL as parameter for a FriendlyURLMapper.
Related
I've configured my IIS (asp.net site) to use URL Rewrite.
In particular this is my rule (dynamic one): whatever url in format number/string will be redirected to a special aspx page.
SSo whatever url starts with mysite/id/Name is redirected to showprof.aspx?id=id&title=Name. This works perfectly.
My question is about search engines. I don't have any "fixed" page that contains links like mysite/id/Name that the spider can scan, so I'm trying to figure it out how search engines could index my dynamic pages. Should I create a sitemap.xml? if yes in wich way? or should I create a "hidden" page that contains every link to all my dynamic contents like mysite/id1/Name1 mysite/id2/Name2 and so on?
thank you
A starting point is definitely a Sitemap.xml, You could try for example the IIS SEO Toolkit and see if it is able to index any of your pages: http://www.iis.net/downloads/microsoft/search-engine-optimization-toolkit
It also has functionality to generate a sitemap.xml, although I'm guessing in your case you probably have some dynamic content, so a better approach would be to have a "handler" that generates it dynamically on demand (maybe cache it for performance reasons).
I would also recommend to have some pages that actually are accessible through normal links, for example maybe have in your home page of the site a link to a "site map" page (not sitemap.xml), where there you render a set of links that you want to index (at least the ones that are most important to you), and that will make them easy to discover.
I used the third party cart system from Ecwid. When I click on any prouduct, it shows this link or URL:
http://www.bestsports.ca/product.php#!/~/product/category=9414048&id=11484861
How can I rewrite this URL instead of showing category id? I want to show the product name. I already tried your above instruction but its not working. Can you please explain is it possible to make this URL into this SEO friendly URL?
http://www.bestsports.ca/MMAGEAR/productname/
I want so show first URL like above URL.
It is not possible for .htaccess to rewrite URLs with a hash (#) symbol in them. That is because everything after the hash is considered a fragment identifier. The purpose of the fragment identifier is to specify the content to be show within the HTML document. It may be handled:
By the browser by scrolling to the correct place in the page
By JavaScript by loading and displaying the specified content
In your case, it appears to specify the AJAX content to be displayed. That is handled client side by JavaScript.
The hash and everything after it are not even sent to your server. They are client side only. Because of this, there is no possibility for your server to rewrite a URL based on the information after the hash. .htaccess can't even get this information.
The only way for you to rewrite these URLs would be to modify the JavaScript in the page to have it change the document.location to the URL of your choice.
First off, apologies for not knowing the nomenclature for what I'm looking for, I'm not typically a Windows web admin.
I have a SharePoint website which contains several subsites. We also have several alternate URLs that point to specific pages, and some of those alternate URLs have friendly URLs which also redirect to other specific pages. We're in the process of migrating from a SharePoint 2007 site to this one, and in the process, I'm trying to remove our reliance on our registrar for handling some of this redirection, because it is apparently not a free service.
Currently our registrar does the following redirects:
http://alias1.tld/* redirects to http://subsite1.ca/page1
http://alias1.tld/friendly redirects to http://subsite1.ca/page2
http://alias2.tld/ redirects to http://subsite1.ca/page3
I know I can accomplish the first and second by setting the sites up in IIS, and using the HTTP Redirect function, but I'm not sure how I can do the second one. In Apache this would be easy, but I'm not sure what I'm looking for here.
Is this something that should be handled within SharePoint, and have that take care of redirecting alias1.tld/friendly to the specific page, or is this something I need to setup in IIS? Is this what URL rewrite is for, or is there a different IIS way to do this?
I'm not sure that this is the best way to do it, but I got things working how I wanted them. Here's what I ended up doing:
Create a new subsite on subsite1 to give me the URL subsite1.ca/subsubsite
Create a redirect from alias1.tld to subsite1.ca/subsite
Create 2 pages for the new subsite. One for the default page and one to use to redirect to page2. Both pages are redirects, Default points to Page1, the second points to Page2.
Set the subsite to use Managed Navigation for global and current through Site Settings > Navigation, and created a default term set by selecting the new subsite in the list and then clicking Create Term Set, then clicking OK.
Then created a term store for the one page that needs to be handled differently by going to Site Settings > Term Store Management. Click on the Term Set created in the last step, then select New Term. On the Term-Driven Pages tab, create the friendly URL and then select the target page, which is the redirect page created in step 3, then click Save.
I'm creating a SEO friendly URL which has some product names, which might have not-so-url friendly characters, eg:
www.foo.com/some-friend/product-name-bla-%numbers-maybe/1234567
I'm only interested in the last id number, however currently IIS redirects to a fault page on some of of my URLs.
I do not wish to disable the Request.Path check.
My question is - How do I sanitize the URLs so they will not bother IIS (preferably in C#) ?
ASP.NET has HttpUtility which lets you escape illegal characters in url or html string.
HttpUtility.UrlEncode(yourString);
Even though you are only going to need the ID at the end of the URL to get data from database, it is a good idea to also check if the SEO friendly part of the url is identical to original url.
If for whatever reason it has changed you should do a 301 permanent redirect to the original in order to avoid creating duplicate content.
Also setting up a canonical meta tag would help you prevent that issue.
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.