1

I want to remove .php extensions from all files. For example if the user puts example.com/test.php I want to to go to example.com/test and show the page content of test.php

But I want the htaccess file to to this function only on ONE url. Not on all the add-on domains I have

How can I do this?

1 Answer 1

1

You may use this rule in your site root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+(test)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]

RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(test)/?$ $1.php [L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.