Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Nov 2016
    Posts
    1
    Member #
    55681

    .htaccess redirect to subfolder with https://www

    Hi everyone,

    So I'm having this website which is stored inside public_html/www/. Some other domains are stored in -for example- public_html/test/. In public_html I have a .htaccess file with a LOT of redirects in it, which all apply to this website inside /www/ folder. Inside the /www/ folder I have another .htaccess (I don't really know why, my colleague did this and he left me with this without information). Since I have no idea how .htaccess exactly works, I have no idea what to do and in which file.

    What I need to do is to redirect domain.nl to https://www.domain.nl (some folders should be excluded, like you can see in the code below - emailtemplates, paymentupdate, autocode, nieuwsbrieven, etc.) But domain.nl is stored inside public_html/www/ folder, so it also needs a redirect to the subfolder (which should not be visible in web browser).

    At this moment, in the root .htaccess file is the following:

    # Use HTTPS
    RewriteCond %{HTTP_HOST} ^(www\.)?domain\.nl [NC]
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !^/emailtemplates
    RewriteCond %{REQUEST_URI} !^/paymentupdate_ideal
    RewriteCond %{REQUEST_URI} !^/autocode
    RewriteCond %{REQUEST_URI} !^/nieuwsbrieven
    RewriteCond %{REQUEST_URI} !^/bevestig-aanmelding-nieuwsbrief
    RewriteCond %{REQUEST_URI} !^/bevestig-afspraak
    RewriteCond %{REQUEST_URI} !^/images/personal
    RewriteCond %{REQUEST_URI} !^/uploadify
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

    # Link to subfolder
    # RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?www.domain.nl$
    RewriteCond %{REQUEST_URI} !^/www/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /www/$1
    RewriteCond %{HTTP_HOST} ^(www.)?www.domain.nl$
    RewriteRule ^(/)?$ www/index.php?page=home [L]

    # Non-www to www
    #activate rewrite engine
    #RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?domain.nl
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    Probably half of this code isn't even necessary, but I have absolutely no clue. The other .htaccess file, within the subfolder /www/, has the following text which I don't really understand (it contains more, but nothing relevant):

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://www.domain.nl/$1/ [L,R=301]
    I'm sorry if I sound stupid. I've tried many things copied from internet, but unfortunately everything has its concequences, which results in other problems with our website (links that don't work anymore, such as). I think the reason it doesn't work all the time, is because it's stored in the subfolder and I don't know how to combine all those lines in one like it would work.

    Can anybody help me explain how to fix this and what is going wrong at this moment? Because the website is now not redirecting to www. It's just redirecting to https which gives me a security error at this moment (because the SSL is stored on www.). SUPER thanks in advance!

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Tags for this Thread

All times are GMT -6. The time now is 01:43 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com