I have a Joomla based website and I use .htaccess to redirect non www,https urls to www,https versions using the rule below:
RewriteEngine on RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule (.*) https://www.example.com%{REQUEST_URI} [R=301,L]
Each article has facebook comments code added manually which points to old non ssl urls:
<div class="fb-comments" data-href="http://www.example.com/links/main_folder/sub_folder/" data-width="625" data-numposts="5" data-colorscheme="light" data-order-by="reverse_time"></div>
Everything was working fine however recently I noted that even the links from Facebooks data-href start redirecting to https which results in losing of old comments.
My questions is how can I modifiy the rule which does not effect links from data-href, there is a diference between old urls structure compared to new ones the old ones uses underscores and new ones hyphens if it helps. Is there a way to excplude links with underscores from this rule? How ever I have pictures that uses underscores also which I do not want to redriect.
1 Answers
Answers 1
If it's only without underscores, you can use:
RewriteEngine on RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{REQUEST_URI} !_ RewriteRule ^ https://www.example.com%{REQUEST_URI} [R=301,L]
0 comments:
Post a Comment