1

How can I do this redirect via htaccess: http://example.com -> htpp://example.com?myparam=123

Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129
Jenya
  • 21
  • 1
  • Possible duplicate of [301 redirect .htaccess](http://stackoverflow.com/questions/4037467/301-redirect-htaccess) – Emile Bergeron Feb 21 '17 at 20:46
  • Other useful links: [Tips for debugging .htaccess rewrite rules](http://stackoverflow.com/q/9153262/1218980), [Reference: mod_rewrite, URL rewriting and “pretty links” explained](http://stackoverflow.com/q/20563772/1218980). – Emile Bergeron Feb 21 '17 at 20:47

1 Answers1

0

You can say that if query string is empty (RewriteCond line) and requested url is / then redirect user to page with that param, if you want to redirect all pages not just root, then you will change RewriteRule to .* for example

RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/?$ /?myparam=123 [L,NC,R=301]
ban17
  • 634
  • 8
  • 12