Rewrite URL in wordpress with subfolders

I would like to make a simple URL rewrite but can not succeed… Here is what I have:

I have 3 websites on the same hosting.

Read More

www.websiteAAA.com – a regular website, located in ‘/website-AAA-folder’ folder

www.websiteBBB.com – a regular website, located in ‘/website-BBB-folder’ folder

www.websiteCCC-Wordpress.com – a WordPress website, , located in ‘/website-CCC-Wordpress-folder’ folder

I order to redirect the requests to the correct domain-filder I have an .htaccess file in the main directory:

Options +SymLinksIfOwnerMatch AddType text/html .shtml 
AddOutputFilter INCLUDES .shtml

#redirect to the correct folder
RewriteCond %{HTTP_HOST}  websiteAAA.com$ [NC]     
RewriteCond %{REQUEST_URI} !^/website-AAA-folder/.*$    
RewriteRule ^(.*)$  /website-AAA-folder/$1 [L]

#redirect to the correct folder
RewriteCond %{HTTP_HOST}  websiteBBB.com$ [NC]     
RewriteCond %{REQUEST_URI} !^/website-BBB-folder/.*$     
RewriteRule ^(.*)$  /website-BBB-folder/$1 [L]

#redirect to the correct folder
RewriteCond %{HTTP_HOST}  websiteCCC-Wordpress.com$ [NC]     
RewriteCond %{REQUEST_URI} !^/website-CCC-Wordpress-folder/.*$     
RewriteRule ^(.*)$  /website-AAA-folder/$1 [L]

in /website-CCC-Wordpress-folder/ (where the wordpress site is), there is an additional .htaccess file:

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

I woulde like to rewite www.websiteCCC-Wordpress.com/aaa/ to www.websiteCCC-Wordpress.com/?id=2&someugleurl=e&blabla=1

I add this line to my .htaccess file that is in the root folder:

RewriteRule ^(aaa)$  ?id=2&someugleurl=e&blabla=1 [L]

However, that does not work.

Please advice.

Thanks

Related posts

Leave a Reply

1 comment

  1. Figured it out

    You have to put the line

    RewriteRule ^(aaa)$  ?id=2&someugleurl=e&blabla=1 [L]
    

    to be first in the htaccess file in wordpress

    RewriteRule ^(aaa)$  ?id=2&someugleurl=e&blabla=1 [L]
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase / 
    RewriteRule ^index.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.php [L] 
    </IfModule>