HTACCESS : Remove .php from but with slash (/) giving internal error

by 4 replies
9
Hi,

Working on a client website for promotion and fixing also coding which cause errors on website.

We found an htaccess error and not getting that how to fix this issue. So need any htaccess expert guide to fix this issue.

https://www.amerrugs.com/about-amer (We can not define our issue without URL so we are adding this URL)

Original page of this URL .... from htaccess we removed .php

But issue is when type of static page like then its giving internal server error.

Htaccess code is as below

PHP Code:
Options +FollowSymlinks

RewriteEngine on

RewriteCond 
%{REQUEST_FILENAME} !-d

RewriteCond 
%{REQUEST_FILENAME}.php -f

RewriteCond 
%{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ ComodoDCV)?$
RewriteRule ^(.*)$ $1.php 
I tried by add below code but still same issue.
PHP Code:
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ ComodoDCV)?$
RewriteRule ^(.*)/$ $1.php 
Please let us know that how can fix this issue.
#programming #error #giving #htaccess #internal #php #remove #slash
  • Banned
    [DELETED]
  • [DELETED]
  • Banned
    [DELETED]
  • Banned
    [DELETED]
  • I didn't test this but this should get you onto the right track.

    RewriteRule !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$ ^(.*)/$ $1.php [L,NC]
  • Yes, you are on the right way you can do it but I checked your website is working fine but anyway.add this,
    To enforce a trailing-slash policy:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*[^/])$ /$1/ [L,R] # <- for test, for prod use [L,R=301]
  • Banned
    [DELETED]
  • hey there, yeah I had the same problem and I got in touch with my hosting provider to revolve it, did you manage to resolve it also?
  • [DELETED]
  • Tried this one ........ not working

    Tried this also but after this giving internal server errors for both URL ....... /about-amer and /about-mer/ both.

    Did not contact to hosting provider ........ will try with details now and see what is going on.

    Still waiting for resolution.
  • Banned
    [DELETED]

Next Topics on Trending Feed