• All I need is a rewrite that will change “domainXYZ.com/anyphrase” into “domainXYZ.com”

    Here is what I am using:

    RewriteCond %{HTTP_HOST} ^domainXYZ\.com
    RewriteCond %{SCRIPT_FILENAME} !wp-admin
    RewriteCond %{SCRIPT_FILENAME} !activity
    RewriteCond %{SCRIPT_FILENAME} !members
    RewriteCond %{SCRIPT_FILENAME} !groups
    RewriteRule ^([A-Za-z0-9-]+)/?$ index.php [L]

    Notes: I added the above to the top of my .htaccess (in WP root). I am running WP 3.1.3 multisite (subdomains), WP MU Domain Mapping plugin, and buddypress on domainXYZ.com. domainXYZ.com is the mapped domain name, not the actual subdomain.

    I was assuming that my rewrite rule would load domainXYZ.com/index.php, which would load the homepage for the wordpress site. However, I get a “page not found” response shown in my buddypress skin (not a full-blown error 404 page).

    Thanks to anyone who can help, Joe

Viewing 7 replies - 1 through 7 (of 7 total)
  • So you’re running buddypress on the mapped domain, which is a secondary blog in the network? Correct?

    If so.. why the rewrite rules? shouldn’t need ’em at all.

    First try turning off BP and ensure the mapped domain works. Then check you specific in the config file that BP’s root blog is not the main site in the network.

    Thread Starter agentoojoe

    (@agentoojoe)

    Hey Andrea, I’ve read quite a few of your posts around this site, particularly those pertaining to buddypress and domain mapping. Thanks for your help.

    So you’re running buddypress on the mapped domain, which is a secondary blog in the network? Correct?

    -Exactly correct

    First try turning off BP and ensure the mapped domain works. Then check you specific in the config file that BP’s root blog is not the main site in the network.

    -I just disabled buddypress, and applied the Twenty-Ten theme to test the mapping. Mapping is working well. However, the mod_rewrite still wont work. It still behaves just like any theme would giving me the “page not found” when you type in mysite.com/not-an-actual-folder-or-page.
    -I double checked my BP root blog setting. It is correct.

    I was wondering, could there be a confliction with the file bp-core-catchuri.php?

    Ipstenu is the htaccess goddess – is what you’re trying to do this?

    redirect any 404 to the mapped domain and not the theme’s 404 page

    Thread Starter agentoojoe

    (@agentoojoe)

    Well, I was thinking that could be one approach, but it seemed a bit messy. Do you know if this would affect SEO at all? Would it be throwing 404 errors still?

    Thread Starter agentoojoe

    (@agentoojoe)

    Solution:
    The rewrite task was killing me, so I just changed the way WP dealt with a 404.

    Unfortunately, I had to alter some WP core files, but the functions I changed were:

    set_404(); (this allowed me to communicate to my theme that certain 404’s should instead load the home template)

    and

    status_header(); (to stop from sending the 404 header when a specific type of nonexistent url is entered)

    Change your last line to

    RewriteRule ^([A-Za-z0-9-]+)/?$ https://domainXYZ.com [L]

    Except a request for a physical file, every request is redirected to index.php.

    Thread Starter agentoojoe

    (@agentoojoe)

    Thanks Ron,
    The only problem with that rule is that when I use an absolute address it acts more like a redirect (address bar gets reset to domainXYZ.com). I need the address bar to read domainXYZ.com/keyword so that I can extract the keyword using $_SERVER[‘REQUEST_URI’] and apply the variable to my application.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Need help with simple rewrite rule (should't this be easy?)’ is closed to new replies.