WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Domain Mapping
[resolved] 301 Redirects Problems (6 posts)

  1. SEO Dave
    Member
    Posted 1 year ago #

    Have domain Mapping working as expected (awesome plugin, saves so much time when you own 100+ domains), trying to setup individual 301 redirects and it isn't working.

    Got a site with hundreds of posts, have moved some posts to other sites so need to setup multiple simple 301 redirects. First issue came about when 301 redirecting from a mapped domain to the main domain, caused a redirection loop because

    Main domain software-bin.com
    Subsite technology.software-bin.com mapped to censusprint.com

    A simple 301 redirect like this works

    Redirect 301 /toshiba-portege-z830-preview/ software-bin.com/toshiba-portege-z830-preview/

    but as it's not specific to censusprint.com it causes a loop since when the redirect goes from censusprint.com/toshiba-portege-z830-preview/ to software-bin.com/toshiba-portege-z830-preview/ the 301 is hitting a loop. Also if /toshiba-portege-z830-preview/ exists on another domain it will redirect to the main domain.

    So that's no good.

    Tried RewriteCond to specify the specific subdomain (added to root .htaccess file)

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^technology.software-bin.com [NC]
    RewriteRule ^/toshiba-portege-z830-preview/$ http://software-bin.com/toshiba-portege-z830-preview/ [NC,L,R=301]

    and nothing happens.

    Read a few forum posts about this and though this is the sort of suggested .htaccess rules none of the OPs have reported back it works, all have said it doesn't work even though the redirect code should work.

    Tried various derivatives of the above like (and others, have tried the mapped domains URL as well replacing technology.software-bin.com with censusprint.com)

    RewriteCond %{HTTP_HOST} !^technology.software-bin.com$ [NC]

    RewriteCond %{HTTP_HOST} ^technology.software-bin.com$ [NC]

    Nothing is working.

    There's a plugin https://github.com/travisward/Simple-301-Redirects--w--domain-mapping- that does work, but it requires inputting the URLs to redirect one at at a time, so to add one rule takes 2 copy and pastes and a button click. That would be a good solution for a small number of redirects (I have it active on the site now, took ages adding 90 redirects), but I've got hundreds of redirects to setup and when I transfer more of my sites to domain mapped installs I have hundreds of simple 301 redirects to migrate into the new setups. It's much easier to add them in a .htaccess file than the above plugin, so looking for a .htaccess solution, someone must have solved this one.

    The above plugin would be great if I could add a list of URLs to redirect in one form like:

    /page1/,domain.com/page1/
    /page2/,domain.com/page2/
    /page3/,domain.com/page3/

    If anyone knows a 301 redirect plugin that's DM compatible that allows a list like the above to be added :-)

    David

  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    Try

    RewriteCond %{HTTP_HOST} ^technology\.software-bin\.com [NC]

  3. SEO Dave
    Member
    Posted 1 year ago #

    Thanks for the suggestion, it's one I'd tried.

    Did figure out the first / on the RewriteRule was causing a problem, think it's because "RewriteBase /", so "RewriteRule ^/25000-applications-in-windows-phone-7-marketplace/$ ...." failed, "RewriteRule ^25000-applications-in-windows-phone-7-marketplace/$ ...." works, but haven't figured out how to get the RewriteCond to work consistently.

    This is the entire root .htaccess file, the top part are the 301 redirects

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^technology\.software-bin\.com [NC]
    RewriteRule ^100000-apps-in-the-app-store-for-ipad/$ http://software-bin.com/100000-apps-in-the-app-store-for-ipad/ [R=301,NC,L]
    RewriteRule ^25000-applications-in-windows-phone-7-marketplace/$ http://software-bin.com/25000-applications-in-windows-phone-7-marketplace/ [R=301,NC,L]
    RewriteRule ^a-code-hidden-spy-million-mobile-phone-users/$ http://software-bin.com/a-code-hidden-spy-million-mobile-phone-users/ [R=301,NC,L]
    RewriteRule ^a-new-interface-google-search-for-tablet-pc/$ http://software-bin.com/a-new-interface-google-search-for-tablet-pc/ [R=301,NC,L]
    RewriteRule ^a-new-version-of-android-market-3-1-5-available-now/$ http://software-bin.com/a-new-version-of-android-market-3-1-5-available-now/ [R=301,NC,L]
    RewriteRule ^android-market-gets-a-major-update-changes-in-design-and-offers-now-and-movies-and-books/$ http://software-bin.com/android-market-gets-a-major-update-changes-in-design-and-offers-now-and-movies-and-books/ [R=301,NC,L]
    RewriteRule ^anyring-his-own-music-as-a-ringtone-for-iphone/$ http://software-bin.com/anyring-his-own-music-as-a-ringtone-for-iphone/ [R=301,NC,L]
    RewriteRule ^apple-has-released-ios-5-and-icloud/$ http://software-bin.com/apple-has-released-ios-5-and-icloud/ [R=301,NC,L]
    RewriteRule ^apple-icloud-beta-version-released/$ http://software-bin.com/apple-icloud-beta-version-released/ [R=301,NC,L]
    RewriteRule ^apple-will-buy-hulu-an-entry-in-the-market-for-video-streaming-possible-for-the-manufacturers-iphone/$ http://software-bin.com/apple-will-buy-hulu-an-entry-in-the-market-for-video-streaming-possible-for-the-manufacturers-iphone/ [R=301,NC,L]
    RewriteRule ^bada-os-web-2-0-reaches-early-as-rom-for-samsung-wave-ii/$ http://software-bin.com/bada-os-web-2-0-reaches-early-as-rom-for-samsung-wave-ii/ [R=301,NC,L]
    RewriteRule ^battlefield-3-beta-delay-occur/$ http://software-bin.com/battlefield-3-beta-delay-occur/ [R=301,NC,L]
    RewriteRule ^call-of-duty-modern-warfare-3-preview/$ http://software-bin.com/call-of-duty-modern-warfare-3-preview/ [R=301,NC,L]
    RewriteRule ^category/software/$ http://software-bin.com/software/software-reviews/ [R=301,NC,L]
    RewriteRule ^cyanogenmod-7-1-rc-now-available/$ http://software-bin.com/cyanogenmod-7-1-rc-now-available/ [R=301,NC,L]
    RewriteRule ^design-concept-for-android-ice-cream-sandwich/$ http://software-bin.com/design-concept-for-android-ice-cream-sandwich/ [R=301,NC,L]
    RewriteRule ^diablo-3-will-allow-trading-with-real-money/$ http://software-bin.com/diablo-3-will-allow-trading-with-real-money/ [R=301,NC,L]
    RewriteRule ^download-map-area-support-to-view-google-maps-in-offline-mode/$ http://software-bin.com/download-map-area-support-to-view-google-maps-in-offline-mode/ [R=301,NC,L]
    RewriteRule ^evernote-2-0-launches-windows-phone-7-5-mango-is-now-available-in-marketplace/$ http://software-bin.com/evernote-2-0-launches-windows-phone-7-5-mango-is-now-available-in-marketplace/ [R=301,NC,L]
    RewriteRule ^facebook-android-version-1-6-now-with-support-video-upload/$ http://software-bin.com/facebook-android-version-1-6-now-with-support-video-upload/ [R=301,NC,L]
    RewriteRule ^facebook-based-java-now-available-for-non-smartphone-phones/$ http://software-bin.com/facebook-based-java-now-available-for-non-smartphone-phones/ [R=301,NC,L]
    RewriteRule ^fall-asleep-easily-wake-up-rested-with-stealthgenie-android-spy-software/$ http://software-bin.com/fall-asleep-easily-wake-up-rested-with-stealthgenie-android-spy-software/ [R=301,NC,L]
    RewriteRule ^firefox-5-beta-for-android-preview/$ http://software-bin.com/firefox-5-beta-for-android-preview/ [R=301,NC,L]
    RewriteRule ^firefox-5-beta-preview/$ http://software-bin.com/firefox-5-beta-preview/ [R=301,NC,L]
    RewriteRule ^first-fifa-13-game-details/$ http://software-bin.com/first-fifa-13-game-details/ [R=301,NC,L]
    RewriteRule ^flash-player-11-beta-available-for-download/$ http://software-bin.com/flash-player-11-beta-available-for-download/ [R=301,NC,L]
    RewriteRule ^glmps-application-for-the-iphone/$ http://software-bin.com/glmps-application-for-the-iphone/ [R=301,NC,L]
    RewriteRule ^gmail-for-mobile-has-many-login/$ http://software-bin.com/gmail-for-mobile-has-many-login/ [R=301,NC,L]
    RewriteRule ^google-android-has-won-nearly-50-of-smartphone-market/$ http://software-bin.com/google-android-has-won-nearly-50-of-smartphone-market/ [R=301,NC,L]
    RewriteRule ^google-announced-the-android-ice-cream-sandwich/$ http://software-bin.com/google-announced-the-android-ice-cream-sandwich/ [R=301,NC,L]
    RewriteRule ^google-application-for-the-iphone-preview/$ http://software-bin.com/google-application-for-the-iphone-preview/ [R=301,NC,L]
    RewriteRule ^google-chrome-11-review/$ http://software-bin.com/google-chrome-11-review/ [R=301,NC,L]
    RewriteRule ^google-chrome-14-the-final-and-stable-version/$ http://software-bin.com/google-chrome-14-the-final-and-stable-version/ [R=301,NC,L]
    RewriteRule ^google-chrome-favorite-for-160-million-users/$ http://software-bin.com/google-chrome-favorite-for-160-million-users/ [R=301,NC,L]
    RewriteRule ^google-earth-6-1-released/$ http://software-bin.com/google-earth-6-1-released/ [R=301,NC,L]
    RewriteRule ^google-has-reached-550000-android-devices-enabled-daily/$ http://software-bin.com/google-has-reached-550000-android-devices-enabled-daily/ [R=301,NC,L]
    RewriteRule ^google-launches-sdk-for-android-3-2/$ http://software-bin.com/google-launches-sdk-for-android-3-2/ [R=301,NC,L]
    RewriteRule ^google-photovine-a-new-way-to-create-photo-albums/$ http://software-bin.com/google-photovine-a-new-way-to-create-photo-albums/ [R=301,NC,L]
    RewriteRule ^google-prepares-to-launch-google-tv/$ http://software-bin.com/google-prepares-to-launch-google-tv/ [R=301,NC,L]
    RewriteRule ^google-preview/$ http://software-bin.com/google-preview/ [R=301,NC,L]
    RewriteRule ^google-released-magnifier-a-site-that-helps-us-to-find-new-music/$ http://software-bin.com/google-released-magnifier-a-site-that-helps-us-to-find-new-music/ [R=301,NC,L]
    RewriteRule ^google-ripples-new-google-apps/$ http://software-bin.com/google-ripples-new-google-apps/ [R=301,NC,L]
    RewriteRule ^google-soon-integrated-in-many-applications/$ http://software-bin.com/google-soon-integrated-in-many-applications/ [R=301,NC,L]
    RewriteRule ^google-updates-android-honeycomb-to-version-3-1/$ http://software-bin.com/google-updates-android-honeycomb-to-version-3-1/ [R=301,NC,L]
    RewriteRule ^honeybar-application-for-honeycomb-tablets/$ http://software-bin.com/honeybar-application-for-honeycomb-tablets/ [R=301,NC,L]
    RewriteRule ^how-to-install-phpauction-in-your-site/$ http://software-bin.com/how-to-install-phpauction-in-your-site/ [R=301,NC,L]
    RewriteRule ^htc-stunning-with-nfc-support-and-related-services/$ http://software-bin.com/htc-stunning-with-nfc-support-and-related-services/ [R=301,NC,L]
    RewriteRule ^internet-explorer-10-available-for-developers/$ http://software-bin.com/internet-explorer-10-available-for-developers/ [R=301,NC,L]
    RewriteRule ^ios-5-1-beta-available-for-developers/$ http://software-bin.com/ios-5-1-beta-available-for-developers/ [R=301,NC,L]
    RewriteRule ^ios-5-beta-2-available-now-preview/$ http://software-bin.com/ios-5-beta-2-available-now-preview/ [R=301,NC,L]
    RewriteRule ^ios-5-beta-4-available-now-as-the-first-update-via-apples-wireless/$ http://software-bin.com/ios-5-beta-4-available-now-as-the-first-update-via-apples-wireless/ [R=301,NC,L]
    RewriteRule ^ios-5-beta-5-available-now-small-preview/$ http://software-bin.com/ios-5-beta-5-available-now-small-preview/ [R=301,NC,L]
    RewriteRule ^ios-5-beta-6-available-for-developers/$ http://software-bin.com/ios-5-beta-6-available-for-developers/ [R=301,NC,L]
    RewriteRule ^ios-5-jailbreak/$ http://software-bin.com/ios-5-jailbreak/ [R=301,NC,L]
    RewriteRule ^istartupvideo-add-any-video-to-start-an-iphone-or-ipad/$ http://software-bin.com/istartupvideo-add-any-video-to-start-an-iphone-or-ipad/ [R=301,NC,L]
    RewriteRule ^lets-talk-iphone-on-4-october-iphone-5-official-launch/$ http://software-bin.com/lets-talk-iphone-on-4-october-iphone-5-official-launch/ [R=301,NC,L]
    RewriteRule ^linux-mint-12-lisa-linux-for-beginners/$ http://software-bin.com/linux-mint-12-lisa-linux-for-beginners/ [R=301,NC,L]
    RewriteRule ^mcafee-launches-wavesecure-for-iphone/$ http://software-bin.com/mcafee-launches-wavesecure-for-iphone/ [R=301,NC,L]
    RewriteRule ^microsoft-has-officially-released-windows-8/$ http://software-bin.com/microsoft-has-officially-released-windows-8/ [R=301,NC,L]
    RewriteRule ^mozilla-firefox-5-0-rc-available-for-download/$ http://software-bin.com/mozilla-firefox-5-0-rc-available-for-download/ [R=301,NC,L]
    RewriteRule ^mozilla-has-released-the-beta-version-of-thunderbird-5/$ http://software-bin.com/mozilla-has-released-the-beta-version-of-thunderbird-5/ [R=301,NC,L]
    RewriteRule ^next-android-will-be-called-android-jelly-bean/$ http://software-bin.com/next-android-will-be-called-android-jelly-bean/ [R=301,NC,L]
    RewriteRule ^next-xbox-could-have-games-comparable-with-avatar/$ http://software-bin.com/next-xbox-could-have-games-comparable-with-avatar/ [R=301,NC,L]
    RewriteRule ^nokia-e6-and-nokia-x7-available-for-sale-nokia-n8-e7-c7-and-c6-update-to-symbian-anna/$ http://software-bin.com/nokia-e6-and-nokia-x7-available-for-sale-nokia-n8-e7-c7-and-c6-update-to-symbian-anna/ [R=301,NC,L]
    RewriteRule ^nokia-sabre-ace-and-sea-ray-receive-now-and-specifications/$ http://software-bin.com/nokia-sabre-ace-and-sea-ray-receive-now-and-specifications/ [R=301,NC,L]
    RewriteRule ^nokia-symbian-anna-available-for-download/$ http://software-bin.com/nokia-symbian-anna-available-for-download/ [R=301,NC,L]
    RewriteRule ^opera-mini-6-1-and-opera-mobile-11-1-released/$ http://software-bin.com/opera-mini-6-1-and-opera-mobile-11-1-released/ [R=301,NC,L]
    RewriteRule ^opera-mini-the-most-popular-browser-for-smartphone/$ http://software-bin.com/opera-mini-the-most-popular-browser-for-smartphone/ [R=301,NC,L]
    RewriteRule ^ovi-store-changes-in-nokia-store-rebranding/$ http://software-bin.com/ovi-store-changes-in-nokia-store-rebranding/ [R=301,NC,L]
    RewriteRule ^play-angry-birds-online-for-free/$ http://software-bin.com/play-angry-birds-online-for-free/ [R=301,NC,L]
    RewriteRule ^samsung-galaxy-s-and-tablet-galaxy-tab-get-android-gingerbread-update-this-month/$ http://software-bin.com/samsung-galaxy-s-and-tablet-galaxy-tab-get-android-gingerbread-update-this-month/ [R=301,NC,L]
    RewriteRule ^samsung-launches-its-own-instant-messaging-service/$ http://software-bin.com/samsung-launches-its-own-instant-messaging-service/ [R=301,NC,L]
    RewriteRule ^samsung-wave-725-with-bada-os-version-2-0-preview/$ http://software-bin.com/samsung-wave-725-with-bada-os-version-2-0-preview/ [R=301,NC,L]
    RewriteRule ^skype-is-now-able-to-video-chat-on-android/$ http://software-bin.com/skype-is-now-able-to-video-chat-on-android/ [R=301,NC,L]
    RewriteRule ^snaptu-became-official-facebook-application-for-mobile/$ http://software-bin.com/snaptu-became-official-facebook-application-for-mobile/ [R=301,NC,L]
    RewriteRule ^sprinkle-a-game-for-the-tegra-2-tablets-pc-to-be-released-soon/$ http://software-bin.com/sprinkle-a-game-for-the-tegra-2-tablets-pc-to-be-released-soon/ [R=301,NC,L]
    RewriteRule ^stress-check-iphone-application-to-measure-stress/$ http://software-bin.com/stress-check-iphone-application-to-measure-stress/ [R=301,NC,L]
    RewriteRule ^symbian-belle-and-a-new-nokia-smartphone-ready-for-launch/$ http://software-bin.com/symbian-belle-and-a-new-nokia-smartphone-ready-for-launch/ [R=301,NC,L]
    RewriteRule ^t-mobile-g2x-gets-android-gingerbread-and-optimus-2x-expected/$ http://software-bin.com/t-mobile-g2x-gets-android-gingerbread-and-optimus-2x-expected/ [R=301,NC,L]
    RewriteRule ^test-vlc-player-for-your-android-device/$ http://software-bin.com/test-vlc-player-for-your-android-device/ [R=301,NC,L]
    RewriteRule ^top-10-applications-social-media/$ http://software-bin.com/top-10-applications-social-media/ [R=301,NC,L]
    RewriteRule ^toshiba-at-200-tablet-pc-a-new-device-android-3-2-honeycomb/$ http://software-bin.com/toshiba-at-200-tablet-pc-a-new-device-android-3-2-honeycomb/ [R=301,NC,L]
    RewriteRule ^two-common-things-that-you-must-avoid-with-cheap-ssl-certificates/$ http://software-bin.com/two-common-things-that-you-must-avoid-with-cheap-ssl-certificates/ [R=301,NC,L]
    RewriteRule ^visidon-applock-android-facial-scanlock-phone/$ http://software-bin.com/visidon-applock-android-facial-scanlock-phone/ [R=301,NC,L]
    RewriteRule ^windows-8-provides-support-for-calls-to-mobile-phone/$ http://software-bin.com/windows-8-provides-support-for-calls-to-mobile-phone/ [R=301,NC,L]
    RewriteRule ^windows-8-full-list-of-features-preview/$ http://software-bin.com/windows-8-full-list-of-features-preview/ [R=301,NC,L]
    RewriteRule ^windows-8-task-manager-review/$ http://software-bin.com/windows-8-task-manager-review/ [R=301,NC,L]
    RewriteRule ^windows-8-theme-for-windows-7/$ http://software-bin.com/windows-8-theme-for-windows-7/ [R=301,NC,L]
    RewriteRule ^windows-mango-phone-available-for-download/$ http://software-bin.com/windows-mango-phone-available-for-download/ [R=301,NC,L]
    RewriteRule ^windows-phone-7-5-mango-review/$ http://software-bin.com/windows-phone-7-5-mango-review/ [R=301,NC,L]
    RewriteRule ^windows-phone-7-mango-preview/$ http://software-bin.com/windows-phone-7-mango-preview/ [R=301,NC,L]
    RewriteRule ^windows-phone-8-windows-phone-tango-discovered/$ http://software-bin.com/windows-phone-8-windows-phone-tango-discovered/ [R=301,NC,L]
    RewriteRule ^youtube-has-introduced-video-editing-function/$ http://software-bin.com/youtube-has-introduced-video-editing-function/ [R=301,NC,L]
    RewriteRule ^windows-8-provides-native-support-for-usb-3-0/$ http://software-bin.com/windows-8-provides-native-support-for-usb-3-0/ [R=301,NC,L]
    </IfModule>
    
    # BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTPS} on
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
    RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]
    
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTPS} !on
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
    RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]
    
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTPS} on
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
    RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]
    
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTPS} !on
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
    RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]
    </IfModule>
    
    # END WPSuperCache
    
    # BEGIN WordPress
    
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    RewriteRule ^images/(.+) wp-includes/ms-files.php?file=$1 [L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress

    I'm either getting no redirection or an infinite loop when I test various RewriteCond,

    I think the issue is

    RewriteCond %{HTTP_HOST} ^technology\.software-bin\.com [NC]

    The mapped domain is http://www.censusprint.com so from the above you can easily work out the 90+ URLs that 301 redirect. The first rule that redirects

    http://www.censusprint.com/100000-apps-in-the-app-store-for-ipad/

    Works.

    But the second infinite loop.

    http://www.censusprint.com/25000-applications-in-windows-phone-7-marketplace/

    So the RewriteRule are working, the RewriteCond isn't working correctly.

    David

  4. SEO Dave
    Member
    Posted 1 year ago #

    Solved it, but worried about the solution.

    RewriteCond only works for one RewriteRule, the 1st rule after the condition, so the format is:

    RewriteCond %{HTTP_HOST} ^technology\.software-bin\.com [NC]
    RewriteRule ^100000-apps-in-the-app-store-for-ipad/$ http://software-bin.com/100000-apps-in-the-app-store-for-ipad/ [R=301,NC,L]
    RewriteCond %{HTTP_HOST} ^technology\.software-bin\.com [NC]
    RewriteRule ^25000-applications-in-windows-phone-7-marketplace/$ http://software-bin.com/25000-applications-in-windows-phone-7-marketplace/ [R=301,NC,L]
    RewriteCond %{HTTP_HOST} ^technology\.software-bin\.com [NC]
    RewriteRule ^a-code-hidden-spy-million-mobile-phone-users/$ http://software-bin.com/a-code-hidden-spy-million-mobile-phone-users/ [R=301,NC,L]
    .....

    For 90 odd 301 redirects I had to add 180+ lines of code, the .htaccess file is 26kb in size!

    Concerned about performance, if I do this with multiple sites and hundreds of posts that's a big file!

    David

  5. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    Concerned about performance, if I do this with multiple sites and hundreds of posts that's a big file!

    You are correct. Doing 100s of these is not great for performance. Rewrite rules are Apache vs WP.

  6. SEO Dave
    Member
    Posted 1 year ago #

    I've gone with the slightly lighter on performance option and used the plugin I linked earlier (redirects stored in the database not the root .htaccess file, pain in the butt to add hundreds of redirects though). Will give it 6 months for Google etc... to pass benefit and then disable the plugin.

    Not ideal as any SEO benefit from links directly to those articles will be partially lost, but they probably don't have important backlinks (just bought the sites and they aren't linked well) so after 6 months Google will know the new domain "owns" the content (that's the main factor, could be hit with a copying content penalty if other sites have scrapped the content) so can drop the redirects.

    Just have to remember around about my birthday next year to disable the 301 redirect plugin :-)

    David

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic