1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

How to solve htaccess issue

Discussion in 'Web Design' started by Kingmati, Jan 14, 2020.

  1. Gogol

    Gogol Jr. VIP Jr. VIP

    Joined:
    Sep 10, 2010
    Messages:
    5,971
    Likes Received:
    5,883
    Gender:
    Male
    Occupation:
    Programmer
    Location:
    Pale Blue Dot
    Home Page:
    Oh shit..

    Ok let's add another redirect rule for empty query string.. Try this:

    Code:
    Options +FollowSymLinks
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #https redirect
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    #no QSR redirect
    RewriteRule ^$ public/index.php [L]
    
    #other redirects
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ public/$1 [L]
    </IfModule>
    By the way..

    Note 1: you could avoid all these troubles by setting your vhost up correctly. To do that, you just needed to have the domain pointed to the public folder instead of the project folder (which is supposed to be private anyway). It's called public for a reason. As for the forum, you could have it inside the public folder. Your htaccess in this case would be much more simpler than this.

    Note 2: Be careful about SEO aspect of the redirect. Do not hold me responsible for that please. :)
     
  2. cnick79

    cnick79 Senior Member

    Joined:
    Jun 10, 2010
    Messages:
    884
    Likes Received:
    479
    Location:
    Wandering
    Move your forum folder into public directory.
     
  3. Kingmati

    Kingmati Registered Member

    Joined:
    Oct 30, 2019
    Messages:
    51
    Likes Received:
    2
    Gender:
    Male
    thank you very much bro, it work perfectly now, thank you are God sent, i really appreciate
     
  4. Gogol

    Gogol Jr. VIP Jr. VIP

    Joined:
    Sep 10, 2010
    Messages:
    5,971
    Likes Received:
    5,883
    Gender:
    Male
    Occupation:
    Programmer
    Location:
    Pale Blue Dot
    Home Page:
    YW :)
    Btw, be sure to do a thorough checking. Even 404 urls and so on.
     
  5. Kingmati

    Kingmati Registered Member

    Joined:
    Oct 30, 2019
    Messages:
    51
    Likes Received:
    2
    Gender:
    Male
    okay, i will do