Shortening the context root of a store's URL makes it easier
for shoppers to remember a link and also improves visibility in search engine
results.
You can change the default site URL from
http://hostname/webapp/wcs/stores/servlet/StoreName/index.jsp to something
shorter, such as: http://hostname/shop/StoreName/index.jsp. In this example,
shop is used to replace the context root, but any name can be used in its
place.
Here the requirement was different, and we need not to
display context root in the URL at all, the context root replacement value
should be blank.
For example:
Old URL:
http://hostname/webapp/wcs/stores/servlet/StoreName/index.jsp
New URL: http://hostname/StoreName/index.jsp
To achieve this functionality we need to update below files:
httpd.conf
wc-server.xml
httpd.conf changes:
If you are running an IBM HTTP Server:
Open the httpd.conf file for editing.
Locate the virtualhost object: <VirtualHost
servername:80> Insert the following code inside the <VirtualHost
servername:80> object before the ending </VirtualHost> tag.
***********************************************
NOTE:
xyz is DNS
RewriteEngine on
******************************************************
ServerName www.xyz.com
ServerAlias www.xyz.com
RewriteCond %{HTTP_HOST} ^xyz.com$
RewriteCond %{REQUEST_URI} ^(/en/myobof/(.*)|/en/myobof)
RewriteRule ^/(.*) /webapp/wcs/stores/servlet/$1 [PT,L]
RewriteRule
^/(.*)$
/webapp/wcs/stores/servlet/$1 [PT,NC]
Locate the virtualhost object: <VirtualHost
servername:443> Insert the following code inside the <VirtualHost
servername:443> object before the ending </VirtualHost> tag.
RewriteEngine on
RewriteRule
^/(.*)$
/webapp/wcs/stores/servlet/$1 [PT,NC]
wc-server.xml changes:
Open the wc-ser.xml for editiong.
Search for the SEOConfiguration section.
Update the element as
given below (update the context-root-rewrite with "/").
<SEOConfiguration defaultUrl="" dynamicUrl="true"
enable="true">
<context-root-rewrite
value="/" />
</SEOConfiguration>
Now you are done
with the changes Restart your web server and app server and validate your
changes.
Refrence : Shortening the context root of a store URL
Refrence : Shortening the context root of a store URL
No comments:
Post a Comment