Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: weeabs on December 05, 2017, 04:19:38 AM

Title: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 05, 2017, 04:19:38 AM
So i'm having problems with figuring out this htaccess code

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{THE_REQUEST} ^.*(.php|mags).* [NC]
   
    RewriteRule ^ / [L,R=301]

    # Redirect Trailing Slashes...


    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>



My problem?
So im trying to incorporate ssi.php into my main website how ever the problem is the current htaccess code wont allow ssi.php to do its job and redirect it to its destined path. and it's due to the portion of the     RewriteRule ^ index.php [L] i believe. So every url the ssi.php spits out ultimately gets redirected to index.php even when ssi.php spits out a proper redirection link. My forum directory is smf. What i want is to be able to
keep the current functionality of the main website and add add smf into the equation.
what are your thoughts?
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Illori on December 05, 2017, 05:04:32 AM
are you using SMF 2.1?
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 05, 2017, 05:23:09 AM
Yes.....Have you any clue to solve this problem :O?...been messing with the htaccess and no clue yet :/
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Arantor on December 05, 2017, 05:32:07 AM
How exactly are you trying to use SSI?
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 05, 2017, 05:49:05 AM
So i just want to use the ssi.php as a way to login and interact with the website.
The problem is the current htaccess wont allow ssi.php to redirect it to the proper file directory.
Because the htaccess is currently set to index.php. i'm trying to set it up where it allows the htaccess to work with index.php
and smf.
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Arantor on December 05, 2017, 05:55:39 AM
You don't redirect to SSI.php, you include it in the files you want to check the user account in.
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 05, 2017, 06:23:51 AM
Quote from: Arantor on December 05, 2017, 05:55:39 AM
You don't redirect to SSI.php, you include it in the files you want to check the user account in.
Right so i included ssi.php into the main website. How ever because the main website has a htaccess that only redirects to index.php
it wont let ssi.php do its job by opening the smf file directory. So i need help solving my htaccess problem. like which type of htaccess code would i need to add where if its in the main website it opens up the file without redirecting to the index.php
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Arantor on December 05, 2017, 07:19:01 AM
Um, that's not how htaccess works assuming you're actually including it directly. So, again, how exactly are you trying to use it? As in, the code you're using.
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 05, 2017, 07:24:06 AM
I must not be explaining myself properly. if thats the case a thousand apologies. You can see a live preview at ~~katsukihill .   com
Try clicking the sign, or login that ssi.php included it'll redirect you to the index.php.
smf is located: ~~~katsukihill    .   com/smf
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Arantor on December 05, 2017, 07:35:47 AM
Ok, so the problem is absolutely nothing to do with SSI.php at all.

The problem is your rewrite rule breaks the entire forum because it matches on the .php of smf/index.php and removes it.

What exactly were you trying to do with that rewrite rule?
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 05, 2017, 07:41:57 AM
Quote from: Arantor on December 05, 2017, 07:35:47 AM
Ok, so the problem is absolutely nothing to do with SSI.php at all.

The problem is your rewrite rule breaks the entire forum because it matches on the .php of smf/index.php and removes it.

What exactly were you trying to do with that rewrite rule?

Ok so the rewrite rule was for the original main website. (It's a small cms). And what i wanted to do was bring smf into the mix by installing it. How ever after installing it i realized the htaccess in the initial cms isn't to to keen on redirecting it to the smf folder because of that rule.  I wanted to know what line would i have to add to allow both the current cms and smf to operate side by side without any problems. The htaccess is what ultimately controls where the link is redirected so i dont think sharing any code would be useful as i already am showing the main problems code. 
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Kindred on December 06, 2017, 01:02:55 AM
You seem to have missed the point,

Your htaccess is removing index.php from the url
That will cause lots and lots of problems
Don't do that.

Then please explain, including code, how you are including ssi.php?
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Arantor on December 06, 2017, 04:46:19 AM
Kindred, it doesn't matter how SSI.php is being included, after seeing the site, it's not relevant.

The entire URL is being munged, from /smf/index.php?action=login to /?action=login because of that rewrite rule, it probably needs to have a RewriteCond to make sure it's not applied to /smf/
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 06, 2017, 07:53:01 AM
exactly thats what i'm looking for. Any ideas friend?
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: Arantor on December 06, 2017, 08:05:36 AM
Before the rewrite rule, try

RewriteCond %{REQUEST_URI} !^/?smf/
Title: Re: Experimenting with htaccess & SSI.php need help.
Post by: weeabs on December 06, 2017, 08:43:29 AM
Wow it works!!!!!!! Thanks a ton!