WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess issues, help please? :) (5 posts)

  1. itrends
    Member
    Posted 6 years ago #

    Hey all, I am just installing wordpress on a site of mine.
    I also run drupal on the site.
    I am having issues getting re-write rules to work for both applications.

    If I put the wordpress rewrites at the top then wordpress works, if I put the drupal ones at the top then drupal works.

    Is there anyway to edit the below code so that there is essentially an "else" clause going on so that if it is a wordpress page it will use one set and if it is a drupal page it will use another?

    # Various rewrite rules.
    <IfModule mod_rewrite.c>
    RewriteEngine on

    # Modify the RewriteBase if you are using Drupal in a subdirectory and
    # the rewrite rules are not working properly.
    RewriteBase /

    # Rewrite old-style URLs of the form 'node.php?id=x'.
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
    #RewriteRule node.php index2.php?q=node/view/%1 [L]

    # Rewrite old-style URLs of the form 'module.php?mod=x'.
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
    #RewriteRule module.php index2.php?q=%1 [L]

    # Rewrite current-style URLs of the form 'index2.php?q=x'.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index2.php?q=$1 [L,QSA]
    </IfModule>

    # $Id: .htaccess,v 1.66 2005/03/20 19:15:00 dries Exp $
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Many thanks,
    David

  2. Jeremy Clark
    Moderator
    Posted 6 years ago #

    Why do you have both in the same directory.

  3. itrends
    Member
    Posted 6 years ago #

    For a number of reasons. :)
    And i don't want wordpress in a sub folder either because of a transition which is due to take place down the road :)

    Anywho,.... is there any way I can do what I want in the same directory? :)

    Thanks,
    Dave

  4. itrends
    Member
    Posted 6 years ago #

    Still stuck....

  5. itrends
    Member
    Posted 6 years ago #

    Ok sorted it,
    I just created a rule for the drupal date format urls:

    # Start Drupal
    <IfModule mod_rewrite.c>
    RewriteEngine on

    # Modify the RewriteBase if you are using Drupal in a subdirectory and
    # the rewrite rules are not working properly.
    RewriteBase /

    # Rewrite current-style URLs of the form 'index2.php?q=x'.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(2004/.*/.*/.*)$ index2.php?q=$1 [NC,L,QSA]
    RewriteRule ^(2005/.*/.*/.*)$ index2.php?q=$1 [NC,L,QSA]
    RewriteRule ^(2006/.*/.*/.*)$ index2.php?q=$1 [NC,L,QSA]
    RewriteRule ^(2007/.*/.*/.*)$ index2.php?q=$1 [NC,L,QSA]
    RewriteRule ^(2008/.*/.*/.*)$ index2.php?q=$1 [NC,L,QSA]
    </IfModule>
    # END Drupal

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php
    </IfModule>
    # END WordPress

Topic Closed

This topic has been closed to new replies.

About this Topic