Page-Level Vanity URL’s:
Open the page properties from siteadmin
Enter the Vanity URL and select Redirect Vanity URL to redirect to the page.
In this approach,
- An author can edit the Vanity URL
- Vanity URL should be unique across the instance
Open the config manager - http://localhost:4502/system/console/configMgr Select Apache Sling Resource Resolver Factory.
Click the + sign in the URL Mappings.
Enter the resolved URL and the vanity URL in the Text box. /content/geometrixx-outdoors/en/men/coats/edmonton-winter.html:/edmonton-winter
Click Save.
In this approach,
Open http://localhost:4502/crx/de/index.jsp
Under /etc/map/http create a node of the type sling:Mapping
Create a property called, sling:internalRedirect, of type String with the value of redirect URL - /content/geometrixx-outdoors/en/men/coats/edmonton-winter.html
Create a property called, sling: match, of type String with the value of vanity URL- [^/]++/edmonton-winter.html
If we want to configure the same vanity URL for two different sites then specify the hostname along with port number as shown below in the vanity URL configuration.
Save all the configurations
Verifying the Vanity URL:
The vanity URL created in the above approaches can be verified by the following steps. Open http://localhost:4502/system/console/jcrresolver
Enter the Vanity URL in the text box and click Resolve
If the vanity URL is configured with Sling Resource Mappings then enter the full URL to resolve - http://localhost:4502/edmonton-winter.html
Dispatcher Rewrite Rules:
Setup virtual hosts for different URLs and specify the Rewrite Rules for redirect to the target URL in httpd.conf file.
<VirtualHost *>
ServerName www.example.com
DocumentRoot /dispatcher/cache/example
RewriteEngine on
RewriteRule ^/edmonton-winter.html$ /content/geometrixx-
outdoors/en/men/coats/edmonton-winter.html [NE,L,R=301] <Directory /dispatcher/cache/example>
<IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks AllowOverride None
</Directory> </VirtualHost>
<VirtualHost *>
ServerName www.example1.com
DocumentRoot /dispatcher/cache/example1
RewriteEngine on
RewriteRule ^/edmonton-winter.html$ /content/geometrixx-outdoors/en/men/coats.html
[NE,L,R=301]
<Directory /dispatcher/cache/example1>
<IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks AllowOverride None
</Directory> </VirtualHost>
Click Save.
In this approach,
- The author can’t edit the Vanity URL
- Vanity URL should be unique across the instance
Open http://localhost:4502/crx/de/index.jsp
Under /etc/map/http create a node of the type sling:Mapping
Create a property called, sling:internalRedirect, of type String with the value of redirect URL - /content/geometrixx-outdoors/en/men/coats/edmonton-winter.html
Create a property called, sling: match, of type String with the value of vanity URL- [^/]++/edmonton-winter.html
If we want to configure the same vanity URL for two different sites then specify the hostname along with port number as shown below in the vanity URL configuration.
Save all the configurations
Verifying the Vanity URL:
The vanity URL created in the above approaches can be verified by the following steps. Open http://localhost:4502/system/console/jcrresolver
Enter the Vanity URL in the text box and click Resolve
If the vanity URL is configured with Sling Resource Mappings then enter the full URL to resolve - http://localhost:4502/edmonton-winter.html
Dispatcher Rewrite Rules:
Setup virtual hosts for different URLs and specify the Rewrite Rules for redirect to the target URL in httpd.conf file.
<VirtualHost *>
ServerName www.example.com
DocumentRoot /dispatcher/cache/example
RewriteEngine on
RewriteRule ^/edmonton-winter.html$ /content/geometrixx-
outdoors/en/men/coats/edmonton-winter.html [NE,L,R=301] <Directory /dispatcher/cache/example>
<IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks AllowOverride None
</Directory> </VirtualHost>
<VirtualHost *>
ServerName www.example1.com
DocumentRoot /dispatcher/cache/example1
RewriteEngine on
RewriteRule ^/edmonton-winter.html$ /content/geometrixx-outdoors/en/men/coats.html
[NE,L,R=301]
<Directory /dispatcher/cache/example1>
<IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks AllowOverride None
</Directory> </VirtualHost>
No comments:
Post a Comment
If you have any doubts or questions, please let us know.