0

I designed and uploaded a site on a mobile format. It shows up fine but ONLY if I type out the http://.

The client wants it to be as simple as possible. How can I have it automatically insert the http://www.?

  • 2
    What shows up if you leave out the http://www? Is it different for other sites on the device you are testing with? – Stephen Ostermiller Apr 27 '18 at 19:56
  • 1
    I removed "DNS" from your question because it shouldn't have anything to do with DNS. If http://example.com/ and http:/www.example.com/ both work when fully typed out, you have DNS set up properly. It is browsers that add the http:// in automatically. – Stephen Ostermiller Apr 27 '18 at 20:00
1

It seems you are not managing URL redirects properly.

Firstly you will have to decide your preferred URL. And then you will also need to make sure other versions of URL should automatically redirect to preferred URL.

Example: Preferred URL: https://www.example.com

Then you need to make sure your other versions of URL automatically redirects to preferred URL like:

  • http:example.com
  • http://www.example.com
  • https://example.com

In Apache hosting, you can easily manage by adding few lines of code in the .htaccess file.

Edited: Following code can be used on Apache server to achieve above.

RewriteEngine On 
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] 
RewriteCond %{http_host} ^example.com [NC] 
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] 

RewriteCond %{THE_REQUEST} ^.*/index.php 
RewriteRule ^(.*)index.php$ https://www.example.com/$1 [R=301,L]
  • Perhaps you could include the "few lines of code" to help the OP otherwise your answer is incomplete. – Steve Apr 28 '18 at 10:56
  • Although having to manually type http:// doesn't sound like a "managing URL redirects" issue. This sounds more like a browser usage problem?! – MrWhite Apr 28 '18 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.