Php mail form not working after changes to .htaccess

Discussion in 'PHP' started by munchkinz, Jun 12, 2012.

  1. #1
    Hi, we have a contact form on our website that sends using a php mail form. I recently made a few changes to the .htaccess file, which I will admit I didn't really understand completely but got it to do what I wanted. The problem now is the form is not coming through to our email.

    Can someone please look at my file and see why?

    Thank you so much to anyone that can help, as this form is a crucial part of our site.

    Here's the htaccess file

    Options +FollowSymLinks -MultiViews# Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    
    RewriteCond %{REQUEST_URI} index\.php
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
    
    
    #remove trailing slashes
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ http://a1barrow.co.uk/$1 [R=301,L]
    
    
    ## hide .php extension
    # To externally redirect /dir/foo.php to /dir/foo
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
    RewriteRule ^ %1 [R,L,NC]
    
    
    ## To internally redirect /dir/foo to /dir/foo.php
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^ %{REQUEST_URI}.php [L]
    
    
    rewritecond %{HTTP_HOST} ^www.MYDOMAIN.co.uk$ [OR]
    rewritecond %{HTTP_HOST} ^MYDOMAIN.co.uk$
    rewriterule ^ "http\:\/\/MYDOMAIN\.co\.uk\/" [R=301,L] #4d3c06025cb45
    
    
    rewritecond %{HTTP_HOST} ^www.MYDOMAIN.co.uk$ [OR]
    rewritecond %{HTTP_HOST} ^MYDOMAIN.co.uk$
    rewriterule ^ "http\:\/\/MYDOMAIN\.co\.uk" [R=301,L] #4d3c05a91d408
    
    
    
    
    rewritecond %{http_host} ^www.MYDOMAIN.co.uk [nc]
    rewriterule ^(.*)$ http://MYDOMAIN.co.uk/$1 [r=301,nc]
    
    
    
    Code (markup):

     
    munchkinz, Jun 12, 2012 IP
  2. Custom IDX/MLS

    Custom IDX/MLS Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your website's contact page at [your co uk site]/contact points to contactengine.php for its contact form processing part.

    However in your htaccess, you've removed .php from server retrieve with RewriteCond %{REQUEST_FILENAME}.php -f , so essentially the form points to /contactengine instead of /contactengine.php

    I suggest you simply put a RewriteRule ^contactengine$ [your co uk site]/contactengine.php [R=301,L] below RewriteRule ^(.+)/$ http://a1barrow.co.uk/$1 [R=301,L]

    Other than that...looks quite messed-up with unnecessary directive to me as well mate )
     
    Custom IDX/MLS, Jun 13, 2012 IP
  3. munchkinz

    munchkinz Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Custom, I have tried your suggestion but it's still not working :~(

    What do you mean about unnecessary directive? I don't really understand .htaccess files, I have over the last few years been teaching myself HTML, CSS and PHP.

    Thank you for any advice.
     
    munchkinz, Jun 13, 2012 IP
  4. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #4
    Now teach yourself how the rewrite engine works. Writing code is simple compared to writing rewrite rules, but you're writing them without actually understanding what they're doing. It shouldn't take you more than a couple of days of full-day study to become pretty proficient at rewrite. (Becoming an expert? I can't say, I've only been doing this stuff for a few decades, and I'm still learning.)
     
    Rukbat, Jun 15, 2012 IP