.htaccess remove specific string at the end of url -
i have old site urls /articles/id?phpsessid=
and want remove ?phpsessid=
@ end of url.
update: have created new site , old moved archive.example.com
. managed redirect old url adding following code .htaccess
file:
rewriterule ^articles/(.*)$ http://archive.example.com/articles/$1 [r=301,l]
but many old links google or fb have @ end ?phpsessid=
can not redirected http://archive.example.com/
, don't know way it?
rewriterule ^articles/(.*)$ http://archive.example.com/articles/$1 [r=301,l]
to prevent query string (ie. ?phpsessid=
) being passed in redirect (ie. remove it) need add ?
@ end of rewriterule
substitution. example:
rewriterule ^articles/(.*)$ http://archive.example.com/articles/$1? [r=301,l]
this creates empty query string on target url. not see trailing ?
. alternatively, can use qsd
(query string discard) flag on apache 2.4+
note removes entire query string, not phpsessid
parameter.
Comments
Post a Comment