1

I have been search through all the questions and browse but haven't found any solution to my case. Hope anyone here could give an answer to my problem.

As we know the way we mask an URL, i use this one : RewriteRule ^([^/]+).htm$ index.php?m=$1 [L]

It will means : www.url.com/home.html => www.url.com/index.php?m=home

My Problem is with the SEO, www.url.com/index.php?m=home has been cached to google but i want the seo-friendly link instead of the one with parameter to be cached to google.

Nah, my question is "Is it possible to disable the link of www.url.com/index.php?m=home so when client entered it at the address bar, it will show nothing or jump to mainpage, while the link of www.url.com/home.html still do showing the home webpage?"

Any help will be appreciated. Thank you..

flicher88
  • 35
  • 2
  • 7

1 Answers1

1

The best way to approach it is by capturing the query string in htaccess, before your current rule, and changing it to the new URI:

RewriteCond %{QUERY_STRING} ^m=([a-z0-9]+)$
RewriteRule ^(.*)$ %1.html? [R=301,L]

This will grab whatever is passed to m, and redirect it to the .html equivalent.

Mike Rockétt
  • 8,947
  • 4
  • 45
  • 81