Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Redirecting Contact Us form in .htaccess

    Greetings,

    Due to the obscene amount of spam, our client wants to redirect ?main_page=contact_us to their corporate website's contact page.

    Anyone have any suggestions how to do so using .htaccess?

    Current .htaccess file:

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    
    # adds www to Browser URL
    RewriteCond %{HTTP_HOST} !^www
    RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R=301]
    
    # From Ultimate SEO URLs
    RewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-c-(.*).html$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-m-([0-9]+).html$ index\.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pi-([0-9]+).html$ index\.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pr-([0-9]+).html$ index\.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pri-([0-9]+).html$ index\.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-ezp-([0-9]+).html$ index\.php?main_page=page&id=$2&%{QUERY_STRING} [L]
    
    # For Open Operations Info Manager
    RewriteRule ^(.*)-i-([0-9]+).html$ index\.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]
    
    # For dreamscape's News & Articles Manager
    RewriteRule ^news/?$ index\.php?main_page=news&%{QUERY_STRING} [L]
    RewriteRule ^news/rss.xml$ index\.php?main_page=news_rss&%{QUERY_STRING} [L]
    RewriteRule ^news/archive/?$ index\.php?main_page=news_archive&%{QUERY_STRING} [L]
    RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html$ index\.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]
    RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html$ index\.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]
    RewriteRule ^news/(.*)-a-([0-9]+)-comments.html$ index\.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^news/(.*)-a-([0-9]+).html$ index\.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]
    
    # All other pages
    # Don't rewrite real files or directories
    RewriteCond %{REQUEST_FILENAME} !-f [NC] 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*).html$ index\.php?main_page=$1&%{QUERY_STRING} [L]
    Thanks!

  2. #2
    Join Date
    Nov 2004
    Location
    Norfolk, United Kingdom
    Posts
    3,036
    Plugin Contributions
    2

    Default Re: Redirecting Contact Us form in .htaccess

    Contact Us is not completely rewritten, but its file type is changed to .html. You can try something like this, but if it doesn't work then use Google to look for alternative answers:

    Redirect 301 /contact_us.html http://www.otherdomain.com/other_contact_us_page

    It may have been better just to install reCaptcha on the Contact Us page, or else change its content so that it just gives people the bricks-n-mortar address, phone number and the email address (minus the actual contact form).

    Vger

  3. #3
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Re: Redirecting Contact Us form in .htaccess

    Quote Originally Posted by Vger View Post
    Contact Us is not completely rewritten, but its file type is changed to .html. You can try something like this, but if it doesn't work then use Google to look for alternative answers:

    Redirect 301 /contact_us.html http://www.otherdomain.com/other_contact_us_page

    It may have been better just to install reCaptcha on the Contact Us page, or else change its content so that it just gives people the bricks-n-mortar address, phone number and the email address (minus the actual contact form).

    Vger
    Hi Vger,

    Thanks for your suggestion.

    We have already tried a redirect for '/contact_us.html' - that actually works when someone clicks on the 'Contact Us' link.

    However, for some reason, if the spammer puts '?main_page=contact_us' in the URL - the Contact Us page comes up and doesn't redirect. This is what the spammers ARE doing - either automated or otherwise.

    We Googled our buts off but kept ending up here :)

    Thanks again!

  4. #4
    Join Date
    Jan 2004
    Posts
    66,391
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: Redirecting Contact Us form in .htaccess

    Rename /includes/modules/pages/contact_us folder to contact_us_DISABLED.
    Then when anyone attempts to access the main_page=contact_us, they'll be sent to the 404 page.
    And, since you said you've already changed all your contact_us links to point someplace else, this 404 will only affect the rogue visitors.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Redirecting Contact Us form in .htaccess

    Add the following to your main .htaccess and test.

    RewriteRule ^index\.php?main_page=contact_us$ http://other_domain.com/contact.html [NC,R=301,L]

  6. #6
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Re: Redirecting Contact Us form in .htaccess

    Quote Originally Posted by DrByte View Post
    Rename /includes/modules/pages/contact_us folder to contact_us_DISABLED.
    Then when anyone attempts to access the main_page=contact_us, they'll be sent to the 404 page.
    And, since you said you've already changed all your contact_us links to point someplace else, this 404 will only affect the rogue visitors.
    Yep, that did the trick. Thanks!

    Any template override for this so during an update we don't have to remember to rename the folder again for our client?

  7. #7
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Redirecting Contact Us form in .htaccess

    Any changes to Core files must be included within your site Documentation - a file you keep for yourself so you know what's going on.

  8. #8
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Re: Redirecting Contact Us form in .htaccess

    Quote Originally Posted by Website Rob View Post
    Add the following to your main .htaccess and test.

    RewriteRule ^index\.php?main_page=contact_us$ http://other_domain.com/contact.html [NC,R=301,L]
    Thanks Rob, Unfortunately that did not work.

  9. #9
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Re: Redirecting Contact Us form in .htaccess

    Quote Originally Posted by Website Rob View Post
    Any changes to Core files must be included within your site Documentation - a file you keep for yourself so you know what's going on.
    Yes, good habit to do - just trying to simply having to remember to update 'change logs'.

  10. #10
    Join Date
    Mar 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Redirecting Contact Us form in .htaccess

    Hello,

    Probably because of fat fingers and old eyes I can't do what the original poster has done--redirect his zencart contact us page a wordpress contact form using .htaccess

    Below are my failed attempts:
    first from the domain root
    1)
    Options +FollowSymlinks
    RewriteEngine on
    Redirect 301 /newcart/contact_us.html http://samedomainascart.com/samedoma...ontact-island/
    2)
    Options +FollowSymlinks
    RewriteEngine on
    Redirect 301 /newcart/index.php?main_page=contact_us http://samedomainascart.com/samedoma...ontact-island/

    second from the zencart directory
    1)
    Options +FollowSymlinks
    RewriteEngine on
    Redirect 301 /contact_us.html http://samedomainascart.com/samedoma...ontact-island/
    2)
    Options +FollowSymlinks
    RewriteEngine on
    Redirect 301 /index.php?main_page=contact_us http://samedomainascart.com/samedoma...ontact-island/

    I know I must be doing something stupid--I follow the rest of the thread especially where Dr. Byte says to then disable the form so the bad guys get 404's but I can't get there. Any help would be appreciated.

    Thanks

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Contact US page + One more Contact FORM :blink:
    By Orange Wacko in forum Managing Customers and Orders
    Replies: 0
    Last Post: 21 Jul 2009, 10:29 PM
  2. SPAM from ‘Contact Us’ form, even though form is removed
    By Beer_man in forum General Questions
    Replies: 5
    Last Post: 3 Dec 2008, 02:40 AM
  3. Contact Us Page Not Redirecting
    By Divalicious Chocolat in forum General Questions
    Replies: 2
    Last Post: 9 Oct 2008, 08:14 PM
  4. Problem redirecting upon form submission
    By dgsignal in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 26 Jun 2008, 06:16 PM
  5. Need help redirecting old htm pages (.htaccess)
    By oldschoolrocker in forum General Questions
    Replies: 8
    Last Post: 1 Jul 2006, 04:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR