0
votes

We use Apache HTTP Server Version 2.4 for redirect example-test-1.com/group/ to example-test-1.com/

I can't able to redirect.

Reference URL Below:-

https://httpd.apache.org/docs/2.4/rewrite/remapping.html#old-to-new-intern

Path of configuration file /etc/apache2/sites-enabled/example-test-1.com.conf setting file

< VirtualHost *:80>

ServerName example-test-1.com
ServerAlias example-test-1.com
RewriteEngine on
Redirect permanent /example-test-1.com/group/  /example-test-1.com/

LogLevel warn
ErrorLog /var/log/apache2/example-test-1.com.error.log
CustomLog /var/log/apache2/example-test-1.com.log combined

ProxyPass / ajp://localhost:8009/
ProxyPassReverse /  ajp://localhost:8009/

any other way possible to achieve it.

4

4 Answers

1
votes

Or, you could check Liferay's own configuration options:


Specify the site name that will default to the company's virtual host. If the specified site has a virtual host, then that will take precedence. If it does not, then it will use the company's virtual host. This property is useful to remove "/web/guest" (or any other site) from the default URL. For example, if this property is not set, then the default URL may be http://localhost:8080/web/guest/home. If this property is set, then the default URL may be http://localhost:8080/home.

Defaults:

  • virtual.hosts.default.site.name=Guest

Set the private group, private user, and public servlet mapping for com.liferay.portal.servlet.FriendlyURLServlet. This value must match the servlet mapping set in web.xml.

For example, if the private group pages are mapped to "/group" and the group's friendly URL is set to "/guest" and the layout's friendly URL is set to "/company/community", then the friendly URL for the page will be http://www.liferay.com/group/guest/company/community. Private group pages map to a site's private pages and are only available to authenticated users with the proper permissions.

For example, if the public pages are mapped to "/web" and the group or user's friendly URL is set to "/guest" and the layout's friendly URL is set to "/company/community", then the friendly URL for the page will be http://www.liferay.com/web/guest/company/community. Public pages are available to unauthenticated users.

The friendly URL's for users, groups, and layouts can be set during runtime.

Defaults:

  • layout.friendly.url.private.group.servlet.mapping=/group
  • layout.friendly.url.private.user.servlet.mapping=/user
  • layout.friendly.url.public.servlet.mapping=/web
0
votes

/web is the URL part that denotes public pages, /group is the part that denotes private pages (followed by the site's friently-URL-name).

You can set a virtual host for your site's pages (public and private, separately) to match the actual hostname (see Site Settings). This needs to be a unique hostname, then it will be taken instead of /web/sitename or /group/sitename to unambiguously name the site. You can find this virtual host in your "Site Content / Configuration / Site Settings" (by default it's empty).

In addition

Redirect permanent /example-test-1.com/group/  /example-test-1.com/

will redirect the URL http://www.example.com/example-test-1.com/group/ to http://www.example.com/example-test-1.com/ if I'm not mistaken. Probably not what you want. As you have already given the ServerName (and superfluous identical ServerAlias, this virtual host won't process anything for any other virtual host anyway and there's no need to specify the domain part, specifically not as non-domain part of the URL.

0
votes

change in /etc/apache2/sites-enabled/.conf file:

<VirtualHost :80 >
  ServerName example-test-1.com
  ServerAlias example-test-1.com 
  RewriteEngine on 
  <Proxy* >  
    AddDefaultCharset Off 
    Order deny,allow Allow from all 
  </Proxy > 

  RewriteRule ^/group/testsite(.) http://%{HTTP_HOST}/testsite$1 [QSA,NE] 
  ProxyPassMatch ^/testsite(.*) ajp://localhost:8009/group/testsite$1 
  ProxyPass/ ajp://localhost:8009/ ProxyPassReverse / ajp://localhost:8009/ 
</VirtualHost > 

And in /etc/hosts file

127.0.0.1       example-test-1.com
0
votes

Say you access site as http:mysite.com/web/guest but you want http:mysite.com/

Here is a simple solution:

  1. Override default company.default.home.url=/web/guest value by adding below line to the portal-ext.properties. If the file is missing create one in /HOME-LIFERAY/Tomcat/webapps/ROOT/WEB-INF/classes , then restart tomcat for the change to take effect.

company.default.home.url =

  1. In Liferay Portal in Control-Panel>Sites>Configuration>Site-Settings>Site-URL in Virtual Hosts->Public Pages add: mysite.com

Click [Save]

You should be able to access the site http:mysite.com/

Enjoy.