skip to Main Content

I have a map file which is working fine with SEO-friendly URLs

Now the customer want that the user should not be allowed to access the technical links means only SEO links should be accessable

e.g my map file looks like

buche-massiv-weiss-lackiert.html /?page=datail&productid=1212

at the moment SEO is working, but what I need is that If the user calls this
technical link i.e

/?page=datail&productid=1212

if should also be first redirected to SEO link and then the page should be called.

what will be the best way to do so?

2

Answers


  1. In the same mapping file add a reverse entries like this:

    /?page=datail&productid=1212 buche-massiv-weiss-lackiert.html
    

    Then have this rule at top of your htaccess for redirection to pretty URL:

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/*(/.*?)sHTTP [NC]
    RewriteCond %1::${mymap:%1} ^(.*)::.
    RewriteRule .* ${mymap:%1}? [L,NE,R=301]
    

    This is assuming name of your RewriteMap is mymap. Change it to whatever your map name is.

    Login or Signup to reply.
  2. With Helicon Ape you could use reverse map on the same map file like this:

    RewriteEngine On
    RewriteMap map_rev txt_rev:my_map_file.txt [NC]
    RewriteCond ${map_rev:$1|NOT_FOUND} (.*)
    RewriteCond %1 !NOT_FOUND 
    RewriteRule (.+) %1 [R]
    

    Then your existing map rule.
    With ISAPI_Rewrite you will have to create another reversed map file and make sure contents of both files are synched. Usage is something like:

    RewriteEngine On
    RewriteMap map_rev txt:my_rev_map_file.txt [NC]
    RewriteCond ${map_rev:$1|NOT_FOUND} (.*)
    RewriteCond %1 !NOT_FOUND 
    RewriteRule (.+) %1 [R]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search