.htaccess - URL Rewrite a previously rewritten URL - htaccess -


ok so... have following url works on site:

http://my_domain.net/w/mrd3nkkm 

the rewrite in root of site is:

rewriterule ^([w])/(\w+)$ res/$1/response.php?id=$2 [l] 

simple stuff , works treat. want redirect traffic hits url unencrypted go on https, below:

https://my_domain.net/w/mrd3nkkm  

so put .htaccess file within res/w/ folder conatining following:

rewritecond %{http:x-forwarded-proto} !https rewritecond %{request_uri} ^/response.php$ rewritecond %{query_string} ^id=(.*)$ rewriterule ^(.*)$ https://my_domain.net/w/$1 [r,l] 

to miind should work, doesn't.

to clear, have following url rewrite working:

http://my_domain.net/w/mrd3nkkm 

and this:

https://my_domain.net/w/mrd3nkkm 

thanks

you should handle http => https before doing internal forward stuff. following should work you:

options +followsymlinks -multiviews rewriteengine on  rewritecond %{https} off rewriterule ^w/.*$ https://%{http_host}%{request_uri} [r=301,l,nc]  rewriterule ^(w)/(\w+)/?$ res/$1/response.php?id=$2 [l,nc] 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -