Forum Moderators: phranque
i have 2 domains pointing to the same content, i want 1 domain to be the main domain showing the homepage and couple exception folders, all other contents goes to the other domain.
rewriteEngine on
rewriteCond %{REQUEST_URI} !^/(folder1¦folder2)/
RewriteRule ^/?([^.]*)$ http://example2.com$1 [L]
the above rewrite only works for the folders, how can i add an extra rewriteCond to make the homepage stay at http://example1.com?
[edited by: jdMorgan at 1:51 pm (utc) on Dec. 12, 2009]
[edit reason] De-linked [/edit]
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(folder1/¦folder[b]2/¦$[/b])
RewriteRule ^/?([^.]*)$ http://example2.co[b]m/$[/b]1 [R[b]=301[/b],L]
That is, this redirect code should be used only to speed up search engine indexing of your new URL-map, and to recover traffic and/or pagerank from bookmarks and links which have not and likely will not be updated. If you're using it for something else, there's probably a better solution available
Also be sure to replace the broken pipe "¦" characters in the patterns above with solid pipes before use; Posting on this forum modifies the pipe characters. Completely-flush (delete) your browser cache before testing any new server-side code.
Jim
or is there a way to modify the default wordpress rewrite to achieve the same solution?
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress