Home > Net >  .htaccess redirect reg. Exp
.htaccess redirect reg. Exp

Time:10-12

I’m trying to redirect this url: (via .htaccess)

https://example.com/index.php?route=information/blogger&blogger_id=4

To

https://example.com/blog/the-new-site

I’m using this code:

rewriterule /index.php?route=information/blogger&blogger_id=4 blog/the-new-site$1 [r=301,nc]

But it doesn’t do anything

Am I missing something or not it right?

CodePudding user response:

This probably is what you are looking for:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^route=information/blogger&blogger_id=4$
RewriteRule ^/?index\.php$ /blog/the-new-site [QSD,R=301,L]

Such a rule can be implemented in the http server's central host configuration. If you do not have access to that you can instead use a distributed coniguration file (often called ".htaccess"). You need to enable the usage of such files for that (see the AllowOverride directive in the documentation).

CodePudding user response:

That did work, actually I did try somthing lige this previously without success. Think I missed the QSD. I Will look into that.

Thanks for fast answer

  • Related