Forum Moderators: phranque
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
I tried playing around with the ReWrite, and specifically put in the subdomain, but I'm still getting redirected. I know that cPanel has an option to redirect a folder, but I don't wanna get stuck in a 301 loop.
Also, all this is on top of the Wordpress Rewrite that is in the .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /index.php [L]
I'm thinking that I should probably put a .htaccess in the subdomain directory with this in it.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*joomla.example.com\index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ [joomla.example.com...] [R=301,L]
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*example.com\index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ [joomla.example.com...] [R=301,L]
RewriteCond %{HTTP_HOST}<>%{THE_REQUEST} ^([a-z]+\.)?example./com(:[0-9]+)?<>[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://%1example.com/$1 [R=301,L]
To suppress the index-to-www.example.com/ redirect for the joomla subdomain only, just add a RewriteCond to your original rule to deactivate it if the joomla subdomain is requested:
RewriteCond %{HTTP_HOST} !^joomla\.example\.com
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]
As a last option, you could use two index-redirect rules, one for joomla, and another for anything-else-but-joomla:
RewriteCond %{HTTP_HOST} ^joomla\.example\.com
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://joomla.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} !^joomla\.example\.com
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]
Jim
[edited by: jdMorgan at 1:29 am (utc) on Dec. 27, 2007]
RewriteCond %{HTTP_HOST}!^joomla\.example\.com
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]
That depends on how you've got the subdomain mapped to your filespace. If you used code in your top-level .htaccess to accomplish the mapping, then all code in that .htaccess file gets executed, regardless of the requested hostname. If you used a control panel, then maybe that code will get executed and maybe it won't -- Control Panel functions vary, and I can't answer questions about the configuration code they produce unless I can see the code.
You can install Apache under XP. Windows support is much improved in Apache 2.x. Just make sure you get all the additional 'pieces' you need to test your site(s), such as PERL, PHP, mySQL, etc. Most people are happiest using one of the 'packaged' installation solutions, such as WAMP or XAMPP, etc. These save you from having to compile all the modules separately and get everything linked-in -- a challenge even for an Apache/*nix expert.
Jim