I want to redirect everything from domain1.com/directory/* to domain2.com/*. For example, domain1.com/directory/file2.ext would redirect to domain2.com/file2.ext. How would I go about accomplishing this? It seems so easy, yet I can't figure it out.
Something like: RewriteEngine On RewriteRule directory/(.*)$ http://www.domain2.com/$1 [R] Code (markup): That should get you going This needs to be placed in the root of domain1.com
Thanks for the help! However, it's not working for some odd reason. I have placed the following on ZuneBoards.com: RewriteEngine On RewriteRule tv/(.*)$ http://www.vidsforzune.com/$1 [R] Code (markup): I want everything from ZuneBoards.com/tv/whatever.ext to go to VidsForZune.com/whatever.ext. Did I set it up correctly? Thanks mate!
That's correct. I just tested my code, with this: RewriteEngine On RewriteRule pastebin/(.*)$ http://$1.pastebin.com/ [R] Code (markup): So anything to http://www.mysite.com/pastebin/whatever becomes http://whatever.pastebin.com/. As a check, can you add: deny from all Code (markup): to the beginning of your .htaccess file, and refresh your site. If it still works, your host is ignoring your .htaccess file, if you get "Forbidden", remove the line and let me know. Jay
That's odd. I do get "Forbidden" so I do know the server is not ignoring the .htaccess. Maybe I should have mentioned this earlier, but my .htaccess already had things on it. Perhaps somethings cancelling something out? Anyways, heres the full file: RewriteEngine on RewriteRule tv/(.*)$ http://www.vidsforzune.com/$1 [R] Options +FollowSymLinks RewriteRule ^([^/]{2}_[^/]{2})/(.*)$ /components/com_jtranspro/index2.php?option=com_jtranspro&no_html=1 [L] RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes## #RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC] #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule (.*) index.php ########## Begin - Rewrite rules to block out some common exploits ## If you experience problems on your site block out the operations listed below ## This attempts to block the most common type of exploit `attempts` to Joomla! # # Block out any script trying to set a mosConfig value through the URL RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] # Block out any script trying to base64_encode crap to send via URL RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] # Block out any script that includes a <script> tag in URL RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] # Block out any script trying to set a PHP GLOBALS variable via URL RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] # Block out any script trying to modify a _REQUEST variable via URL RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) # Send all blocked request to homepage with 403 Forbidden error! RewriteRule ^(.*)$ index.php [F,L] # ########## End - Rewrite rules to block out some common exploitsRewriteCond %{HTTP_REFERER} !^http://aggressivegamers.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://aggressivegamers.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://b3ar.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://b3ar.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://forumbusinessblog.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://forumbusinessblog.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.aggressivegamers.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.aggressivegamers.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.b3ar.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.b3ar.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.forumbusinessblog.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.forumbusinessblog.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.socialsuccessnow.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.socialsuccessnow.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zunetv.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zunetv.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://zunetv.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://zunetv.zuneboards.com$ [NC] RewriteRule .*\.([^/]{2}_[^/]{2})$ - [F,NC] Code (markup): Thanks again
Hello, Yes, a conflict existed. Possibly: RewriteEngine on RewriteRule tv/(.*)$ http://www.vidsforzune.com/$1 [R,L] Options +FollowSymLinks RewriteRule ^([^/]{2}_[^/]{2})/(.*)$ /components/com_jtranspro/index2.php?option=com_jtranspro&no_html=1 [L] RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php #OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes## #RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC] #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule (.*) index.php ########## Begin - Rewrite rules to block out some common exploits ## If you experience problems on your site block out the operations listed below ## This attempts to block the most common type of exploit `attempts` to Joomla! # # Block out any script trying to set a mosConfig value through the URL RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] # Block out any script trying to base64_encode crap to send via URL RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] # Block out any script that includes a <script> tag in URL RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] # Block out any script trying to set a PHP GLOBALS variable via URL RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] # Block out any script trying to modify a _REQUEST variable via URL RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) # Send all blocked request to homepage with 403 Forbidden error! RewriteRule ^(.*)$ index.php [F,L] # ########## End - Rewrite rules to block out some common exploitsRewriteCond %{HTTP_REFERER} !^http://aggressivegamers.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://aggressivegamers.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://b3ar.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://b3ar.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://forumbusinessblog.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://forumbusinessblog.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.aggressivegamers.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.aggressivegamers.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.b3ar.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.b3ar.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.forumbusinessblog.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.forumbusinessblog.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.socialsuccessnow.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.socialsuccessnow.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zunetv.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.zunetv.zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://zuneboards.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://zunetv.zuneboards.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://zunetv.zuneboards.com$ [NC] RewriteRule .*\.([^/]{2}_[^/]{2})$ - [F,NC] Code (markup): Backup your original first. Also, yours had an error as the line OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc Code (markup): Wasn't commented out Jay