Get Querystring and redirect with . htaccess

Asked

Viewed 123 times

0

I would like to get the querystring URL : url.htm and direct with htaccess. I’m about to make it:

RewriteRule ^([A-Za-z-]+)\.htm$ conteudo.php?url=$1&%{QUERY_STRING} [qsappend]
RewriteRule ^conteudo.php(.*)$ http://meusite.com/nova-url-%1? [R=301,L]

Ex:

Grab the URL

www.meusite.com/url.htm

and play to

www.meusite.com/nova-url-url.htm

But with that .htaccess he does so:

Upshot: www.meusite.com/nova-url-

Does not return the url.htm

That’s all I need to finish.

  • the flag [qsappend] indicates query string append then you don’t need to add &%{QUERY_STRING} in the rule Rewriterule.

  • could explain where the file conteudo.php enters your rule? it is in . htaccess but you have not described what it should do. Apparently it’s just makes the link between the two Rewriterule

1 answer

1

the replacement is wrong in:

RewriteRule ^conteudo.php(.*)$ http://meusite.com/nova-url-%1? [R=301,L]

The %1? should be $1

  • Unfortunately it’s not right either. It returns nothing at the end of the URL

Browser other questions tagged

You are not signed in. Login or sign up in order to post.