VirtualHosting and Solutions for sticky URL

Using mod_rewrite to handle various content issues

VirtualHosting and Solutions for sticky URL

Postby smileysudha » Tue May 20, 2008 7:09 pm

Dear Friends,
Here is a solutions for masking the URL and to make them as sticky URL
Also see the Virtual host concept has been implemented along with that...!!!

Code: Select all
<VirtualHost *:80>
   DocumentRoot "/var/apache/htdocs/folder../melon/en"
   Alias /common/ /var/apache/htdocs/folder../common/
  # Alias /images/ /var/apache/htdocs/folder../melon/en/images/
  Alias /melon/en/ /var/apache/htdocs/folder../melon/en/
      <Directory "/var/apache/htdocs/folder../melon/en">
                Options -Indexes FollowSymLinks MultiViews +Includes
                AddType text/html .shtml .inc .html
                AddHandler server-parsed .shtml .html .htm
                Allow from all
   #DirectoryIndex index.html
   RewriteEngine  on
   RewriteRule ^(/melon/en/)(.*)$ http://%{HTTP_HOST}/$2   [R=301,L]
   ErrorLog /var/apache2/logs/error_log
   TransferLog /var/apache2/logs/access_log

Here i am trying to mask or remove the melon/en from the URI to make them sticky throughout the Application.

Code: Select all
   RewriteRule ^(/melon/en/)(.*)$ http://%{HTTP_HOST}/$2   [R=301,L]

Here is what is done ^ stands for start with /melon/en .... *
%(HTTP_HOST) is the actual domain name /$2
$2 holds the remains of URI removing the /melon/en/
while $1 holds the clipped path (/melon/en/)
(.*) from all

And thats how a sticky URL is done...!!!
Hope this would be fruitful to you guys...!!!

Sudhakar R.
Posts: 1
Joined: Tue May 20, 2008 6:22 pm

Postby richardk » Thu May 22, 2008 3:01 pm

You can also do the redirect with Redirect
Code: Select all
Redirect 301 /melon/en/ /
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Content

Who is online

Users browsing this forum: No registered users and 3 guests