for my localhost:80/content/sample-project/us/en.html should point to www.sample-project.com/learn or sample-project/learn how to achieve these scenarios.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Ronnie09
You can follow below steps:
In httpd conf file:
ServerName sample-project.com:80
In v-host file under <VirtualHost *:80>: -
ServerName sample-project.com
ServerAlias www.sample-project.com
and then rewrite rule as:
RewriteRule ^/(.*)$ /$1 [PT,L]
Hi @Ronnie09 ,
1. Add entry in resource mappings at OSGI config in AEM
/config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml
resource.resolver.mapping="[/:/,/content/sample-project/us/en:/]"
2. Add Apache server rewrite rules
RewriteRule ^/$ /content/sample-project/us/en.html [PT,NE,L]
RewriteRule ^/(.*)$ /content/sample-project/learn/$1 [PT,NE]
Hope that helps!
Regards,
Santosh
Defining the virtual host configuration and rewrite rule should fix the problem.
Please refer the document below for more information
@Ronnie09 This can be handle in two steps.
First, you would need to assign your local host a domain name
https://ecompile.io/blog/localhost-custom-domain-name
Second, add a redirect rule in the dispatcher
RewriteRule "^/learn$" "https://%{SERVER_NAME}/content/sample-project/us/en.html" [R,L]
Hope this helps.
Hi @Ronnie09
You can follow below steps:
In httpd conf file:
ServerName sample-project.com:80
In v-host file under <VirtualHost *:80>: -
ServerName sample-project.com
ServerAlias www.sample-project.com
and then rewrite rule as:
RewriteRule ^/(.*)$ /$1 [PT,L]