1

I managed to remove the .extension via the htaccess file, but I was wondering if this is possible through the apache2.conf or some other file without using the .htaccess file.

Exp.

example.com/example

instead of

example.com/example.html

1 Answer 1

1

You can use these 2 rules in Apache conf file:

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

# To internally forward /dir/file to /dir/file.html
RewriteCond %{DOCUMENT_ROOT}/$1\.html -f [NC]
RewriteRule ^(.+?)/?$ $1.html [L]
Sign up to request clarification or add additional context in comments.

1 Comment

Those don't work with the apache conf. It gives me an error. Aren't those rules for the .htaccess?

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.