apache - RewriteRule with question marks htaccess -


i know been asked lot still did not succeeded

i have in htaccess

rewriterule    ^embed/([0-9a-za-z]{12})$        /cgi-bin/index_dl.cgi?op=video_embed&file_code=$1 [l]  rewriterule    ^embed/([0-9a-za-z]{12})/(\d+)x(\d+)$        /cgi-bin/index_dl.cgi?op=video_embed2&file_code=$1&w=$2&h=$3 [l] 

i want

rewriterule    ^embed/?v=([0-9a-za-z]{12})$     /cgi-bin/index_dl.cgi?op=video_embed&file_code=$1 [l]  rewriterule    ^embed/?v=([0-9a-za-z]{12})/(\d+)x(\d+)$     /cgi-bin/index_dl.cgi?op=video_embed2&file_code=$1&w=$2&h=$3 [l] 

adding ?v=

rewritecond %{query_string}  ^v=(.*)$ [nc] rewriterule ^embed/%1([0-9a-za-z]{12})/(\d+)x(\d+)$ /cgi-bin/index_dl.cgi?op=video_embed2&file_code=$1&w=$2&h=$3 [nc,l] rewriterule    ^embed/%1([0-9a-za-z]{12})$      /cgi-bin/index_dl.cgi?op=video_embed&file_code=$1 [nc,l] 

not working

example mysite.com/embed/?v=abcde mysite.com/embed/?v=abcde/6x6

currently mysite.com/embed/abcde mysite.com/embed/abcde/6x6

so work

rewritecond %{query_string} ^v=(.*)$ [nc] rewriterule ^embed/?$       /cgi-bin/index_dl.cgi?op=video_embed2&file_code=%1 [l] 

i have noticed have in file

rewritecond %{http:authorization} ^(.*) rewriterule ^(.*) - [e=http_cgi_authorization:%1] rewritecond %{query_string}     ^v=(.*)$    [nc] rewriterule ^$       /cgi-bin/index_dl.cgi?op=download1&id=%1      [nc,l] 

i still trying make work

rewritecond %{query_string} ^v=(.*)/(\d+)x(\d+)$ [nc] rewriterule ^embed/?$       /cgi-bin/index_dl.cgi?op=video_embed2&file_code=%1&w=$2&h=$3 [l] 

you not using rules - passing %1 rules won't you, because you're not matching correctly. request_uri , query_string 2 different things. rewriterule able check request_uri, , not query_string, shown in answer suggested panama jack.

to achieve want, need use following instead:

rewriteengine on  # check mysite.com/embed/?v=abcde/6x6 rewritecond %{query_string} ^v=([^&/]+)\/(\d+)x(\d+)$ [nc] rewriterule ^embed/?$       /cgi-bin/index_dl.cgi?op=video_embed2&file_code=%1&w=%2&h=%3 [l]  # check mysite.com/embed/?v=abcde rewritecond %{query_string} ^v=([^&]+)$ [nc] rewriterule ^embed/?$       /cgi-bin/index_dl.cgi?op=video_embed&file_code=%1 [l] 

here, check query string each case. if there match, rewrite if we're @ /embed/ (trailing slash optional - may remove question mark if wish trailing slash required).


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -