Submit Your Article Forum Rules

Results 1 to 6 of 6

Thread: Combining my .htaccess rewrites with WordPress rewrites

  1. #1

    Combining my .htaccess rewrites with WordPress rewrites

    I am just having a bit of a problem and hope someone can help me. I have to sketch a scenario for you to understand.

    My standard .htaccess on my site mantaseosolutions.com looks like this
    RewriteEngine On
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.php? [NC]
    RewriteRule ^(([^/]*/)*)index\.php?$ http://www.mantaseosolutions.com/$1 [R=301,L]

    RewriteCond %{HTTP_HOST} ^mantawebsolutions.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.mantawebsolutions.com$ [OR]
    RewriteCond %{HTTP_HOST} ^mantaseosolutions.com$
    RewriteRule ^(.*)$ http://www.mantaseosolutions.com/$1 [R=301,L]

    Redirect 301 /contactus.php http://www.mantaseosolutions.com/contactus/index.php
    Redirect 301 /newsroom.php http://www.mantaseosolutions.com/news/index.php

    ErrorDocument 404 http://www.mantaseosolutions.com

    This works a 100% for my site. I have now added a wordpress blog to my site under the /blog/ folder and want to redirect all my old news pages (previously under /news/ folder) to the new location on the blog.

    In my new /blog/ folder I am using the wordpress rewrite in a seperate .htaccess file saved in this particular folder as follow:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    </IfModule>

    I cannot figure out how to correctly set up my two .htaccess files (or combine them) to give me what i want.

    I want to redirect all my old posts under the /news/ folder to the new post under /blog/ but this does not happen.

    Example:
    http://www.mantaseosolutions.com/news/news.php?id=31 must redirect to http://www.mantaseosolutions.com/blo...ark-completed/

    Can anyone help ?

  2. #2
    WebProWorld MVP incrediblehelp's Avatar
    Join Date
    Jan 2004
    Posts
    7,463
    How are you editing this file? You may be adding extra characters (on accident) that might be messing it up.

  3. #3
    incredible, thanks, but i don't think it's that. i am using PHP designer to do my editing, but i could just as well have used Homesite+ or Notepad. I am pretty sure there are now extra characters.

    the problem is not that my .htaccess file don't work. it's a case of the one is ignoring some conditions while the other is overuling them.

    the .htaccess file for my site is doing what it is supposed to do. eg: http://www.mantaseosolutions.com/contactus.php does redirect to http://www.mantaseosolutions.com/contactus/index.php

    and http://www.mantaseosolutions.com/wrongpage/ does go to the homepage (no 404 page)

    but when I want to redirect http://www.mantaseosolutions.com/news/news.php?id=31 to http://www.mantaseosolutions.com/blo...ark-completed/, it also simply goes to the homepage and not to the new page in the /blog/ folder. It seems the wordpress RewriteCond tells it something different.

    There is perhaps something small I am missing - can't figure out what tho...

  4. #4
    WebProWorld MVP incrediblehelp's Avatar
    Join Date
    Jan 2004
    Posts
    7,463
    manta you find out what was happening?

  5. #5
    Jaan, not really, no. I think it has to do with the rewrites for the blog itself, but i cannot be sure, so what i've done was to keep the two sections seperate. One .htaccess file for my site and one .htaccess file for my blog.

    So both work independantly from each other but it still does not solve my redirect issue for http://www.mantaseosolutions.com/news/news.php?id=31 that should redirect to http://www.mantaseosolutions.com/blo...ark-completed/

    I will tackle this again in a few days, when I geet through all my client work... (can you believe that i just said that???)

  6. #6
    WebProWorld MVP incrediblehelp's Avatar
    Join Date
    Jan 2004
    Posts
    7,463
    Yeah I have been slammed of late to, back to work or sleep :(

Similar Threads

  1. Combining Wordpress MU and Elgg.
    By kgun in forum WordPress Discussion Forum
    Replies: 2
    Last Post: 02-10-2010, 01:14 PM
  2. URL rewrites goog says no make the pages real static
    By Steven1976a in forum Search Engine Optimization Forum
    Replies: 0
    Last Post: 12-24-2009, 09:49 AM
  3. 301 reditects, .htaccess and Wordpress
    By morestar in forum IT Discussion Forum
    Replies: 24
    Last Post: 11-24-2009, 08:02 PM
  4. Need help on wordpress .htaccess
    By loosapphire in forum Search Engine Optimization Forum
    Replies: 11
    Last Post: 10-09-2009, 05:00 AM
  5. WordPress htaccess issues
    By imsickofwebpro in forum Web Programming Discussion Forum
    Replies: 6
    Last Post: 01-18-2008, 10:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •