Forums

The WordPress MU forums have moved to the MultiSite forum on WordPress.org

Help with apache rewrite rule in htaccess (3 posts)

  1. guadix
    Member
    Posted 2 years ago #

    Hello everyone, I'm a new user of this forum but I have been reading it for a while, and it have been quite useful.
    I'm trying to migrate from Wordpress to Wordpress MU and the process is almost finished.
    The problem I have now is that in my original worpdress installation I had blogs in http://domain/aBlog and in http://domian/subfolder/AnotherBlog. Most blogs where like http://domain/aBlog, and I couldn't create a blog in wordpress named "/subfolder/AnotherBlog" because it transforme it to something like "/subfolderAnotherBlog". So I thought of using a rewrite rule in my htaccess (Apache 2.0).

    I used this site to test the regex:

    So I came with this expression RewriteRule (/fotografos/) / which is quite simple and it works in that page, but it does nothing.
    Reading this site: I tryied this: RewriteRule ^fotografos/(.*) / [L] and it doesn't work neither. I tried several more, but this two seems the most probable.

    I don't know if I'm putting them in the wrong place of the .htaccess (which is in my document root).

    My actual .htaccess is this:

    RewriteEngine On
    RewriteBase /
    
    # Rewrite www.  greyes.com to greyes.com
    # RewriteCond %{HTTP_HOST} ^www\.(.*)
    # RewriteRule ^(.*) http://%1/$1 [R,L]
    
    #fotografos
    RewriteRule (/fotografos/) /
    #RewriteRule ^fotografos/(.*) / [L]
    
    #uploaded files
    RewriteRule ^(.*)?/?files/(.*) wp-content/blogs.php?file=$2 [L]
    RewriteRule ^(.*)?/?uploads/(.*) wp-content/blogs.php?file=$2 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Please, any help you can give about this will be most welcome!

  2. guadix
    Member
    Posted 2 years ago #

    I'm sorry the links are this:

    http://www.regexplanet.com/simple/index.jsp where I tested the expression

    http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Apache mod_rewrite site

  3. guadix
    Member
    Posted 2 years ago #

    If anyone if wondering, I resolved it putting `#fotografos
    RewriteRule ^fotografos/(.*) /$1 [R=301,L]` as the first rule in my .htaccess.

Topic Closed

This topic has been closed to new replies.

About this Topic