Hide text Externally from the URL

Discussion in 'Apache' started by Jayaram Ponnusamy, Jun 22, 2016.

  1. #1
    Dear All,
    I am new to Apache, We are using CMS system. By default we are getting CMS URL pattern is like http:// <domain>/sites/<sitename>/<local-value>/<contents or campaign name>
    • Here sites is context name of the WebApplication
    • sitename is name of the Site which we given while create site in CMS.
    • locale-value by default it will come en_US for English, ar_SA for Arabic
    Ours is Multilingual site and using English & Arabic Contents. So, We want to change the name ar_SA to ar only, and dont want to display en_US from the URL.

    So, I tried below Rewrite Rule, I think this rule applied for both internal & externally. So, It's changing the URL in Client-Browser, but getting 404 error page.

    RewriteEngine on
    #English
    RedirectMatch "^/sites/ar_SA/(.*)" "/sites/ar/$1"
    RewriteRule ^/sites/ar_SA/(.*) /sites/ar/$1 [L]
    
    #Arabic
    RewriteRule "^/sites/en_US$" "/sites/$1" [R]
    RewriteRule "^/sites/(.*)$" "/qu/" [R]
    Code (markup):
    Please help me to resolve this issue.
    Thanks
    Jayaram
     
    Last edited by a moderator: Jun 25, 2016
    Jayaram Ponnusamy, Jun 22, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Shouldn't this be just:
    RewriteEngine on
    #English
    RewriteRule ^/sites/<sitename>/en_US/(.*) /sites/$1 [L, QSA]
    RewriteRule ^/sites/<sitename>/ar_SA/(.*) /sites/ar/$1 [L, QSA

    #note, the above will also remove <sitename> from the final url, if you need that, add it to the destination url
     
    PoPSiCLe, Jun 24, 2016 IP