New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
About URL Redirection
I have few hard coded urls in a php file .. is it possible to redirect them using .htaccess
For example the links are http://demo.mydomain.com/pic/image.jpg
Is it possible to redirect these image urls to https:// through .htaccess
Thank you for your replies in advance
Comments
EDIT:
as requested by OP in his second post:
Sorry I forgot to mention that the urls are external urls and i.e http://demo.externalurl/pic/image.jpg
No, you can't
Unless you have access to the external url's .htaccess, no, you can't.
What if, for example, the OP had a Website template that used "generic" URLs as in his example, and he wanted to host that template on HIS server where HE has control of the .htaccess file? Instead of having to edit every URL in the template (and yes, maybe the template could be written better) he could just use .htaccess to "correct" the generic URLs?
In theory, this could be useful for cases where you have multiple Web site hosts that serve the same or similar data that you would replicate across the multiple hosts and let the .htaccess of that host control the actual URL redirection specific to that host.
By mangling DNS resolution, then 'sort-of' yes
Better to Search-and-Replace them from demo.externalurl to local.myurl first
Thank you very much all for great replies.. I also have another issue
Mixed Content: The page at 'https://www.mydomain.com/url-urlname/' was loaded over HTTPS, but requested an insecure image 'http://www.mydomain.com/'. This content should also be served over HTTPS.
I am using CloudFlare.. has any experienced the same ?
Add the HTTPS redirection rule on CF using page rules.
Please read: https://support.cloudflare.com/hc/en-us/articles/200172286-How-do-I-do-url-forwarding-with-CloudFlare-