mod rewrite - mod_rewrite - replace word or character in url -
am trying mod_rewrite url, unfortunately without luck.
http://mywebsite.com/gallery/mycustom-gallery/linkid417
should changed to:
http://mywebsite.com/gallery/mycustom-gallery/#417
where '417' dynamic id of image & mycustom-gallery
change every-time.
i've tried following rules, none seems work...
rewriterule ^/gallery/$1/#([a-za-z0-9_-]+)/([a-za-z0-9_-]+)/y/([0-9]+)$ /gallery/$1/linkid [l,r=301] rewriterule mycustom-gallery/#.*$ /mycustom-gallery/linkid=417/$1
regards, charl
if trying rewrite http://mywebsite.com/gallery/mycustom-gallery/linkid417 http://mywebsite.com/gallery/mycustom-gallery/#417 can follows:
rewriterule ^/gallery/([a-za-z0-9_-]+)/linkid([0-9]+)$ /gallery/$1/#$2 [ne,l,r=301]
the ne|noescape
flag prevents apache escaping hash in url during 301 redirect.
if wish opposite, i.e. redirect http://mywebsite.com/gallery/mycustom-gallery/#417 http://mywebsite.com/gallery/mycustom-gallery/linkid417, cannot done, fragment part of request ("#417") not passed apache along request per rfc1808.
Comments
Post a Comment