Advertisement:

Author Topic: Experimenting with htaccess & SSI.php need help.  (Read 623 times)

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Experimenting with htaccess & SSI.php need help.
« on: December 05, 2017, 04:19:38 AM »
So i'm having problems with figuring out this htaccess code

Code: [Select]
<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?

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,049
Re: Experimenting with htaccess & SSI.php need help.
« Reply #1 on: December 05, 2017, 05:04:32 AM »
are you using SMF 2.1?

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Re: Experimenting with htaccess & SSI.php need help.
« Reply #2 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 :/

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,035
    • Arantor on GitHub
Re: Experimenting with htaccess & SSI.php need help.
« Reply #3 on: December 05, 2017, 05:32:07 AM »
How exactly are you trying to use SSI?
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Re: Experimenting with htaccess & SSI.php need help.
« Reply #4 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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,035
    • Arantor on GitHub
Re: Experimenting with htaccess & SSI.php need help.
« Reply #5 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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Re: Experimenting with htaccess & SSI.php need help.
« Reply #6 on: December 05, 2017, 06:23:51 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,035
    • Arantor on GitHub
Re: Experimenting with htaccess & SSI.php need help.
« Reply #7 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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Re: Experimenting with htaccess & SSI.php need help.
« Reply #8 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,035
    • Arantor on GitHub
Re: Experimenting with htaccess & SSI.php need help.
« Reply #9 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?
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Re: Experimenting with htaccess & SSI.php need help.
« Reply #10 on: December 05, 2017, 07:41:57 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. 

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,098
  • Gender: Male
    • Kindred-999 on GitHub
Re: Experimenting with htaccess & SSI.php need help.
« Reply #11 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?
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,035
    • Arantor on GitHub
Re: Experimenting with htaccess & SSI.php need help.
« Reply #12 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/
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Re: Experimenting with htaccess & SSI.php need help.
« Reply #13 on: December 06, 2017, 07:53:01 AM »
exactly thats what i'm looking for. Any ideas friend?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,035
    • Arantor on GitHub
Re: Experimenting with htaccess & SSI.php need help.
« Reply #14 on: December 06, 2017, 08:05:36 AM »
Before the rewrite rule, try

Code: [Select]
RewriteCond %{REQUEST_URI} !^/?smf/
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline weeabs

  • Newbie
  • *
  • Posts: 8
Re: Experimenting with htaccess & SSI.php need help.
« Reply #15 on: December 06, 2017, 08:43:29 AM »
Wow it works!!!!!!! Thanks a ton!