News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Experimenting with htaccess & SSI.php need help.

Started by weeabs, December 05, 2017, 04:19:38 AM

Previous topic - Next topic

weeabs

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?

Illori


weeabs

Yes.....Have you any clue to solve this problem :O?...been messing with the htaccess and no clue yet :/

Arantor


weeabs

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.

Arantor

You don't redirect to SSI.php, you include it in the files you want to check the user account in.

weeabs

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

Arantor

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.

weeabs

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

Arantor

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?

weeabs

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. 

Kindred

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?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

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/

weeabs

exactly thats what i'm looking for. Any ideas friend?

Arantor

Before the rewrite rule, try

RewriteCond %{REQUEST_URI} !^/?smf/

weeabs


Advertisement: