Wordpress is killing my rewrite in another directory

Discussion in 'Apache' started by Kerosene, Dec 14, 2012.

  1. #1
    I have a "go" directory where I use urls like mydomain.com/go/digitalpoint
    Links like mydomain.com/go/digitalpoint used to work, I have touched nothing, but now they go to a WordPress 404 page.
    If I use mydomain.com/go/index.php?s=digitalpoint then it works fine.

    Wordpress installed in root directory.

    /.htaccess (created by WordPress)
    # 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 (markup):
    /go/.htaccess
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d 
    RewriteRule ^([^/.]+)/?$ index.php?s=$1 [QSA,L]
    Code (markup):
    /go/index.php
    $keyword = $_GET['s'];
    echo $keyword;
    PHP:
    The broken site is hosted at HostGator.
    I am using exactly the same files on a different host, and it works fine. :confused:

    Any ideas?
     
    Kerosene, Dec 14, 2012 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Looks like an execution order thing for the .htaccess files (one host is running the .htaccess in the go directory first, the other one, the other way around). Do you have access to the underlying Apache conf files (like a VPN or something)? Then you could just put them in there.

    Another option would be to put the /go/.htaccess file into the WordPress .htaccess file before WordPress's normal rewrite rules. Like something along these lines (I didn't test it, but something along those lines):

    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	RewriteBase /
    	
    	RewriteRule ^go/(.*)	go/index.php?s=$1 [QSA, L]
    	
    	RewriteRule ^index\.php$ - [L]
    	RewriteCond %{REQUEST_FILENAME} !-f
    	RewriteCond %{REQUEST_FILENAME} !-d
    	RewriteRule . /index.php [L]
    </IfModule>
    Code (apache):
     
    digitalpoint, Dec 18, 2012 IP