• I am using WordPress 3.0.1 as the front end for my web application.
    I have most of it working, but I need some help customizing “.htaccess”

    Here is what works:

    1. I use Exec-PHP plugin to run my embedded PHP code inside a WordPress “Page” called “app”.
    2. I use pretty Permalinks for good SEO. This URL = “https://site.com/app/” displays the correct page and runs my code.
    3. To pass parameters to my app, this URL = “https://site.com/app/?a=alpha&b=beta” also displays the correct page, and my PHP code can see the parameters in $_GET['a'] and $_GET['b'].

    Here is where I need help with “.htaccess”

    I want this URL = “https://site.com/app/alpha/beta” to be rewritten using the Apache2 mod_rewrite engine to become “https://site.com/app/?a=alpha&b=beta” and then display the correct page (like item 3) above.

    I have tried adding various things in “.htaccess”, but I can’t get it to work. I typically end up with a WordPress 404 page being displayed.

    Here is the .htaccess file created when installing WordPress 3.0.1.

    [code]
    # .htaccess
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    [/code]

    I am sure there must be lots of folks using WordPress as a front end for their web app, and others with expertise in .htaccess syntax. Any answers or pointers to solutions would be much appreciated.

    thanks in advance,

    David Jones
    [email protected]
    https://dxjones.com

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    This might work. Put it before the WP rules, outside their block.

    RewriteEngine On
    RewriteRule ^app/([^/]+)/([^/]+)$ /app/?a=$1&b=$2 [QSA]
    Thread Starter dxjones

    (@dxjones)

    Thanks for the suggestion.

    I tried that, but it didn’t work for me.

    I always get a WordPress page saying:

    Error 404 – Page Not Found!
    Whoops! Something broke. Please try again!

    Here is the current content of my .htaccess (my “app” is called “keyword”)

    # .htaccess

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^keyword/([^/]+)/([^/]+)$ /keyword/?a=$1&b=$2 [QSA]
    RewriteRule ^keyword/([^/]+)$ /keyword/?a=$1 [QSA]
    </IfModule>

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    I am still looking for a solution, …

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to modify .htaccess for web app (in combination with WordPress)’ is closed to new replies.