Forum Moderators: phranque
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# if requested subdomain is not base domain
RewriteCond %{HTTP_HOST} !^example\.com$
# and we have not already rewritten this request to the subdomain's subfolder
RewriteCond %{REQUEST_URI} !^/category/.*
# extract requested subdomain to %1
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$
# rewrite the request to the subdomain's subfolder
RewriteRule (.*) /category/%1/$1
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine on
# WP standard
RewriteRule ^index\.php$ - [L]
# if requested subdomain is not base domain
RewriteCond %{HTTP_HOST} !^example\.com$
# and we have not already rewritten this request to the subdomain's subfolder
RewriteCond %{REQUEST_URI} !^/category/.*
# extract requested subdomain to %1
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$
# rewrite the request to the subdomain's subfolder and than index.php
RewriteRule (.*) /category/%1/$1 [C]
RewriteRule . /index.php [L]
# WP standard
RewriteCond %{REQUEST_FILENAME} !-f
# WP standard
RewriteCond %{REQUEST_FILENAME} !-d
# WP standard
RewriteRule . /index.php [L]
strip per-dir prefix: D:/Sites/example/ ->
applying pattern '^index\.php$' to uri ''
strip per-dir prefix: D:/Sites/example/ ->
applying pattern '(.*)' to uri ''
RewriteCond: input='test.example.com' pattern='!^example\.com$' => matched
RewriteCond: input='/' pattern='!^/category/.*' => matched
RewriteCond: input='test.example.com' pattern='^([^\.]+)\.example\.com$' => matched
rewrite '' -> '/category/test/'
applying pattern '.' to uri '/category/test/'
rewrite '/category/test/' -> '/index.php'
internal redirect with /index.php [INTERNAL REDIRECT]
[redir#1] (3) strip per-dir prefix: D:/Sites/example/index.php -> index.php
[redir#1] (3) applying pattern '^index\.php$' to uri 'index.php'
[redir#1] (1) pass through D:/Sites/example/index.php
# rewrite the request to the subdomain's subfolder and than index.php
RewriteRule (.*) /category/%1/$1 [C]
RewriteRule . /index.php [L] # rewrite the request to the subdomain's subfolder and than index.php
RewriteRule (.*) /category/%1/$1 [PT]
# rewrite the request to the subdomain's subfolder
RewriteRule (.*) /category/%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$
RewriteRule ^$ /index.php?category_name=%1 [L]