regex - Using or ( | ) statement in .htaccess rewrite rules -
instead of writing 2 rewrite rules pointing same page, though able 1 rule using or statement ( | ):
rewriterule ^([\d]+)-post[\d]*\.html|#post([\d]+) /post.php?p=$1.html [r=301,nc,l]
also tried $2 @ end since 1 show anyway:
rewriterule ^([\d]+)-post[\d]*\.html|#post([\d]+) /post.php?p=$1$2.html [r=301,nc,l]
with above rule, work fine:
site.com/14729-post9.html
however, not work(even though tested here , should work: http://regexpal.com/):
site.com/post.php?p=14729#post14729
is there way make work or have create 2 separate rules?
btw, more server intense 1 way or other?
okay have understand in-document named links such #post14729 never passed server browser. when link contains in-document named link, example: click on <a href='http://some.host.com/foo.php?id=1&bar=2#post250'>some link</a>
. here browser strips #post250
part when sending some.host.com , sends url /foo.php variables id=1 , bar=2. when result of comes browser, search '#post250' named anchor in content , scroll make visible if needed. '#post250' cannot sent browser without javascript trickery.
your rewriteengine isn't seeing '#post14729' @ all.
Comments
Post a Comment