.htaccess rules and making wordpress play nice with code igniter

Hi Guys!
I'm hoping one of you with your giant brains can help me or give me some insight into this issue I'm having.

A client asked me to build a complete front end for him using wordpress - which I did and it runs beautifully - using some of the amazing plugins from here I might add :wink:

Unfortunately the 'backend' of his site was built by another company and they used code igniter to create it. I have no experience whatsoever using code ignitor other than knowing it is a cms.

So here's my issue - wordpress' mod_rewrite rules aren't playing nice with code igniter's since both of them use dynamic urls. I can get wordpress to ignore the physical directory in which the 'backend' is installed in but can't seem to get it to ignore the dynamic urls code ignitor is creating as well.

So I've put the following in my .htaccess and it works fine for the index file that code ignitor is using, (from /admin) but any of the paths that were created by code igniter (say /admin/advertisers) are still getting throttled by wordpress and throwing up a 404.

RewriteRule ^admin/.*$ - [PT]

I have searched and searched but I can't seem to find a solution - maybe I'm using the wrong keywords.

Also - quick side questions - is it possible to use the .htaccess to get wordpress to ignore subdomains altogether? Dynamic ones too?

This project is making me tear my hair out - what seemed very simple is turning into something way more complex.

Any help you guys could give me would be much appreciated - thanks in advance!

  • DavidM
    • DEV MAN’s Mascot

    Hello mdsone,

    I'll have to run this one by the team over here and see if anyone's familiar with CodeIgniter as I haven't worked with the framework before. Hopefully someone else from the community has some thoughts on this as well!

    Cheers,
    David

  • Mason
    • DEV MAN’s Sidekick

    Whew, htaccess is not my strong point either.

    Perhaps something like this:
    RewriteRule ^admin - [L]

    Make sure it's placed before all of the other rules and it should tell Apache that when it gets a path starting with "admin" then leave it alone (-) and don't check any more rules ([L]).

    Anybody else have an idea? Let us know how it goes for ya.

  • Philip John
    • DEV MAN’s Apprentice

    I *think* Mason's solution should work.

    The issue here is that the rules WordPress adds to your .htaccess as I understand them do this;
    - intercept ALL requests
    - check if the URL being accessed is a physical file
    - if it is, serve it (this is why your /admin index is working fine
    - if not, pass the request through the re-write rules WordPress has (i.e. permalinks)

    Effectively, what you need to do is turn this around slightly so that the process is like this;
    - intercept ALL requests
    - check if the URL being accessed is a physical file
    - if so, serve it (this should mean WP gets served for the home page still)
    - if not, pass the request through to CodeIgniter

    Not the fundamental difference is that the default for requests is changed from WP to CodeIgniter.

    I can't promise that'll work but that's how it works in my (not so large) head :slight_smile:

    Phil

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.