Hide file extension in url




















Remove a file extension through. For those who are still looking for a simple answer to this; You can remove your file extension by using. Because when user copies the URL from address bar or tries to reload or even coming back from history, your standart Apache Router will not be able to realize what are you looking for and throw you a Error.

You need a dedicated Router for this purpose to make your app understand what does the URL actually means by saying something Server and File System has no idea about. I leave here my solution for this. This is tested and used many times for my clients and for my projects too. It supports multi language and language detection too. Read Readme file is recommended. It also provides you a good structure to have a tidy project with differenciated language files you can even have different designs for each language and separated css , js and php files even more like images or whatever you have.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How can I remove file extension from a website address? Ask Question. Asked 10 years, 6 months ago.

Active 1 year, 7 months ago. Viewed k times. I am designing a website. How can I get this done? Improve this question. Peter Mortensen That's called Pretty URLs and there are already a ton of questions about it. This is nearly 3 years after Stack Overflow launched. There must be a duplicate somewhere. Add a comment. Active Oldest Votes. Improve this answer. Alex G 2, 9 9 gold badges 36 36 silver badges 74 74 bronze badges. The first four lines deal with the removal of the extension and the following, with the addition of the trailing slash and redirecting.

But, you could just change the extension of your HTML file from. For those who are not so experienced with. The code should look like this:. How to remove. What is an. Features With an. The definitive guide.

A more extended example is to redirect all requests with. If you use. For this to happen you have to declare a few rewrite conditions and rewrite rules RewriteCond and RewriteRule.

This is more complete, clear and faster than to create an exception for every file type possible. To remove the. Use what works best for you, and add a canonical meta tag in your HTML head to avoid duplicate content where appropriate.

Hi, my name is Jan.



0コメント

  • 1000 / 1000