1

I have tried to find the answer, but I failed. Other questions are with htaccess.

I found this question similar of my question, but I did not get my answer.

I need it without .htaccess, because I do not have permission of URL rewriting in my client's server.

How can I achieve this?

5
  • 3
    no, you can't. htaccess is just a way to override httpd.conf settings. if you don't have .htaccess rights, then you definitely don't have httpd.conf rights, and nothing you can do in your PHP code will suddenly make the server "ignore" .php or tell the server to treat .html as if it was .php. Commented Aug 13, 2014 at 18:48
  • @anubhava How can I do it using header function ? Commented Aug 13, 2014 at 18:50
  • Actually I misspoke. I agree with @MarcB here. If .php extension is missing then your php scripts won't be even called. Commented Aug 13, 2014 at 18:53
  • Have you tried using a .html or .htm file with <?php and ?>? Normally the apache module add the parsing of *.html and/or *.htm files to the list, if i recall it right... Commented Aug 13, 2014 at 19:00
  • Does this answer your question? How to hide PHP file extension without using .htaccess Commented Nov 30, 2019 at 19:27

1 Answer 1

2

If you don't have access to your .htaccess or httpd.conf file the you could set up a proxy (like nginx) in front of the web server, point the DNS record to this proxy and have the proxy rewrite the requests from .html to .php to pass on to your apache server.

However, if you don't have access to .htaccess or httpd.conf files, you probably don't control the DNS records...

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.