WordPress.org

Support

Support » How-To and Troubleshooting » .htaccess issues, help please? :)

.htaccess issues, help please? :)

  • 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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Jeremy Clark

    @jeremyclark13

    Member

    Why do you have both in the same directory.

    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

    Still stuck….

    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘.htaccess issues, help please? :)’ is closed to new replies.