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

4 replies
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 /about-amer.php .... from htaccess we removed .php

But issue is when we are adding slash at last of this type of static page like /about-amer/ 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.
#error #giving #htaccess #internal #php #remove #slash
Avatar of Unregistered
  • Profile picture of the author littleguyhosting
    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]
    {{ DiscussionBoard.errors[11626868].message }}
  • Profile picture of the author marksmith121
    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]
    {{ DiscussionBoard.errors[11626884].message }}
  • Profile picture of the author Eholic
    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?
    {{ DiscussionBoard.errors[11627014].message }}
  • Profile picture of the author Thinkfast
    Originally Posted by littleguyhosting View Post

    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]
    Tried this one ........ not working

    Originally Posted by marksmith121 View Post

    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]
    Tried this also but after this giving internal server errors for both URL ....... /about-amer and /about-mer/ both.

    Originally Posted by Eholic View Post

    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?
    Did not contact to hosting provider ........ will try with details now and see what is going on.

    Still waiting for resolution.
    Signature
    Reduce SEO Cost by Buy Credits Packages - Save Upto 50% SEO Budget.
    Guest Posting Sites List - 10k+ Sites Collection, No PBN , Multiple Niche Markets .
    {{ DiscussionBoard.errors[11627413].message }}
Avatar of Unregistered

Trending Topics