I used following code for hiding .php extension but mail() function stopped working. What is the problem?

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]


RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]

Mail function & redirect

    mail($to,$subject,$message,$headers);       
    header('Location: http://xyz.com/');

Can you show the error you getting?

IF possible try this it may work out-

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
RewriteEngine on

RewriteCond $1 !^(index\.php|assets|css|js|images|ckeditor|uploads|swf|fonts|theme|robots\.text|get_capcha\.php|ajax|img|prettify)
RewriteRule ^(.*)$ /your project name/index.php/$1 [L]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.