4 Replies - 1400 Views - Last Post: 17 July 2014 - 01:39 AM

#1 bowtie00  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 03-January 14

Redirect with GoDaddy

Posted 16 July 2014 - 07:01 AM

I am currently hosting two sites with GoDaddy. I just bought an SSL for one of them and decided to redirect users from HTTP to HTTPS.
I haven't work with the .htaccess file before. I was able to redirect them but now my subdomains also redirect. Could someone give me a hand?

My .htaccess file:
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.html [L]   
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} !=domain2.ca.domain.com
RewriteRule ^ https://www.domain.com%{REQUEST_URI} [R,L]



Lines 1 to 6 just remove the extension for pages. I tried adding the second last line but it didn't help.

Thanks in advance.

Im also getting a 500 Internal Error. My goal for the .htacess file. To remove all file extensions, so domain.com/about.html turns to domain.com/about.php. I was hoping this could happen for both the main domain and sub domains. And that only the main domain redirects to a https page. All the sub domains are un affected.

Is This A Good Question/Topic? 0
  • +

Replies To: Redirect with GoDaddy

#2 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5389
  • View blog
  • Posts: 27,386
  • Joined: 10-May 07

Re: Redirect with GoDaddy

Posted 16 July 2014 - 07:21 AM

It should be just as simple as checking for https, force, then check the extension, force.

# Force HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NC]

# Force PHP
RewriteRule ^(.*).html$ $1.php [R=301,NC,L]



Verified with http://htaccess.madewithlove.be/, to force only https & html, not css or jpg.
Was This Post Helpful? 0
  • +
  • -

#3 bowtie00  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 03-January 14

Re: Redirect with GoDaddy

Posted 16 July 2014 - 09:33 AM

This still makes sub domains, redirect back to the root domain.
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5389
  • View blog
  • Posts: 27,386
  • Joined: 10-May 07

Re: Redirect with GoDaddy

Posted 16 July 2014 - 09:43 AM

Testing with subdomains on http://htaccess.madewithlove.be/ shows that subdomains do not get redirected.

My suggestion is to move the provided code above any other rewrite rules you have & put a stop processing flag [il][L][/ul] after it. There is probably something treating subdomains elsewhere in the htaccess file.

Also, without knowing the domain, it's impossible to verify dns as a 'catch all' or configuration issue. Meaning by the time it gets to htaccess, does it still have a subdomain? This can be verified by viewing the access logs.
Was This Post Helpful? 0
  • +
  • -

#5 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 38
  • View blog
  • Posts: 897
  • Joined: 06-July 13

Re: Redirect with GoDaddy

Posted 17 July 2014 - 01:39 AM

I had a similar problem forcing the www prefix to my site, it redirected al subdomains to www.subdomain.mysite.com/subdomain/ and I moved the code between the

<IfModule mod_rewrite.c>

</IfModule>

and it worked.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1