I was helping a friend with a website and I created few php pages that he then copied to the root. The problem is that the htaccess file is setup in a way that I'm not able to access any of the new php files that I created but I can access all the html files. I looked into a lot of documentation for editing htaccess but I couldn't make it work. Any help is appreciated. The new pages that I have added are contact.php, show-captcha.php and thank-you.php
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [NC]
#RewriteCond %{REMOTE_ADDR} !71\.239\.5\.36
#RewriteCond %{REQUEST_URI} !/maintenance.html$
#RewriteCond %{REQUEST_URI} !/img(.*)$
#RewriteCond %{REQUEST_URI} !/sync/$
#RewriteRule $ /maintenance.html [R=302,L]
##Errors##
ErrorDocument 400 /error.php
ErrorDocument 401 /error.php
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php
##Redirect##
RewriteCond %{HTTP_HOST} ^www.example.net [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ https://example.net/$1 [R,L]
##Common Files##
RewriteRule ^(.*)\~\57(.*)$ $1Main.php?file=$2 [NC]
RewriteRule ^(.*)ajax\57(.*)$ $1Main.php?ajax&$2 [NC]
RewriteRule ^(.*)sync\57(.*)$ $1Main.php?sync&$2 [NC]
RewriteRule ^(.*)backup\57(.*)$ $1Main.php?backup&$2 [NC]
RewriteRule ^(.*)SampleDoc(\57)(.*[^\57])(\57?)$ $1index.php?count=$3 [NC]
##REDIRECTS##
RewriteRule ^(.*)menu(\57)(.*[^\57])(\57)(.*[^\57])$ $1menu.php [NC]
RewriteRule ^(.*)menu(\57)(.*[^\57])(\57?)$ $1menu.php [NC]
RewriteRule ^(.*)menu(\57?)$ $1menu.php [NC]
RewriteRule ^(.*)checkout(\57)(.*[^\57])(\57)(.*[^\57])$ $1checkout.php [NC]
RewriteRule ^(.*)checkout(\57)(.*[^\57])(\57?)$ $1checkout.php [NC]
RewriteRule ^(.*)checkout(\57?)$ $1checkout.php [NC]
RewriteRule ^(.*)ThankYou(\57)(.*[^\57])(\57?)$ $1ThankYou.php?$3 [NC]
RewriteRule ^(.*)ThankYou(\57?)$ $1ThankYou.php [NC]
RewriteRule ^(.*)Contact(\57)(.*[^\57])(\57?)$ $1contact.php?$3 [NC]
RewriteRule ^(.*)Contact(\57?)$ $1contact.php [NC]
RewriteRule ^(.*)account(\57)(.*[^\57])(\57)(.*[^\57])(\57)(.*[^\57])$ $1account.php?type=$3&email=$5&code=$7 [NC]
RewriteRule ^(.*)account(\57)(.*[^\57])(\57?)$ $1account.php?type=$3 [NC]
RewriteRule ^(.*)account(\57?)$ $1account.php [NC]
RewriteRule ^(.*)catering(\57)(.*[^\57])(\57)(.*[^\57])$ $1catering.php?$3$5 [NC]
RewriteRule ^(.*)catering(\57)(.*[^\57])(\57?)$ $1catering.php?$3 [NC]
RewriteRule ^(.*)catering(\57?)$ $1catering.php [NC]
RewriteRule ^(.*)changepassword\57(.*[^\57])\57(.*[^\57])$ $1account.php?type=changepssd&email=$2&code=$3 [NC]
RewriteRule ^(.*)join(\57)(.*[^\57])(\57)(.*[^\57])$ $1account.php?type=join&email=$5&code=$7 [NC]
I tried to add contact.php but you can see it's not helping.
You don't need the rewrite rules at all if you are not going to move path variables to the query string. Just remove the RewriteRules for the contact page. If you are still getting the not found page, remove
ErrorDocument 500 /error.php
All errors, from Page Not Found to Server Errors are all getting the same error.php. There may be some error in your contact.php and that is why you always get this page.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With