Forum Moderators: phranque
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteCond %{REQUEST_URI} ^/index.php*$ [NC]
RewriteRule ^(.*)$ http://subdomain.example.com/$1 [R=301,L]] [R=301,L] should be [L,R=301]
wouldn't changing the 'superfluous' link structure as you suggested break all of my cross-links and back links
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# BEGIN WordPress <automatically inserted>
<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
#Redirect Joomla links to subdomain
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteCond %{REQUEST_URI} ^/index.php*$ [NC]
RewriteRule ^(.*)$ http://archive.example.com/$1 [R=301] If I put the Joomla redirect ahead of the WP rewrite, it breaks WP links. If I place it below, the WP rewrite overrides the Joomla redirect.
index.php?option=com_content&task=view&id=123
[edited by: Das_Capitolin at 1:01 am (utc) on Jun 16, 2013]
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# Redirect Joomla links to subdomain
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
#RewriteCond %{REQUEST_URI} ^/index.php*$ [NC]
RewriteCond %{QUERY_STRING} (^|&)option=com_content(&|$) [NC]
RewriteRule ^(.*)$ http://archive.example.com/$1 [R=301,L]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Each and every single URL on the archived Joomla site consists of "index.php?option=com_content"
RewriteCond %{QUERY_STRING} option=com_content
RewriteCond %{HTTP_HOST} !joomla-subdomain\.example\.com
RewriteRule ^index\.php http:// {et cetera with the subdomain} [R=301,L]
RewriteCond %{HTTP_HOST} !joomla-subdomain.example.com
RewriteCond {wp-stuff-here}
RewriteRule . /index.php [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{REQUEST_URI} !index\.php
RewriteRule (^|/|\.html) /index.php [L]
Why We Make You Do It Yourself
There are plenty of forums where you can post a "how-to" question and get a fairly immediate answer. The answer may even be correct. But WebmasterWorld is about teaching you how to do it yourself. That way you can roll your own htaccess-- not just for today's problem but for tomorrow's almost identical one.
Here is the analogy:
Your child's room needs cleaning. You know that you can clean it yourself much faster and better than if you have to stand over your child and force him to do it right. But if you do the "make him get it right" part often enough, you will have raised a child who knows how to clean his room-- and who will some day stand glowering over his own children in the same circumstances.
Some day, someone else will post a question in the WebmasterWorld forums and you'll say "Hey, I know the answer to that one!"
Well, NOW you say so.Well, actually lucy, I said so in my original post.
What I need to do now is create an .htaccess file at the root that will redirect URLs containing "index.php?option=com_content&task=view&id=123" and forward them to an identical page in the subdomain. Redirect
example.com/index.php?option=com_content&task=view&id=123
To
sub.example.com/index.php?option=com_content&task=view&id=123
I said so in my original post. # Redirect Joomla links to subdomain
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
#RewriteCond %{REQUEST_URI} ^/index.php*$ [NC]
RewriteCond %{QUERY_STRING} (^|&)option=com_content(&|$) [NC]
RewriteRule ^(.*)$ http://archive.example.com/$1 [R=301,L]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
RewriteCond %{HTTP_HOST} ^example.com$ #RewriteCond %{REQUEST_URI} ^/index.php*$ (^|&)option=com_content(&|$) RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# Redirect Joomla links to subdomain
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteCond %{QUERY_STRING} (^|&)option=com_content(&|$) [NC]
RewriteRule ^(.*)$ http://archive.example.com/$1 [R=301,L]
# Block libwww-perl (LWP) scripts
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* – [F,L]
# WordPress permalinks
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# Compress file types
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/js text/javascript application/xml application/xhtml+xml application/javascript application/x-javascript application/x-httpd-php application/x-httpd-fastphp application/x-httpd-eruby application/rss+xml application/atom_xml image/svg+xml
# Deny access to .htaccess
<Files .htaccess>
Order Deny,Allow
Deny from all
</Files>
# Deny access to wp-config.php
<Files wp-config.php>
Order Deny,Allow
Deny from all
</Files> # Block libwww-perl (LWP) scripts