删除以.php,.js,.asp等结尾的网址文件 [英] Remove URL file ending (.php , .js , .asp etc)

查看:133
本文介绍了删除以.php,.js,.asp等结尾的网址文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于删除url栏中文件结尾的问题(类似于 .php,.html,.js,.asp 部分)。我的目标是,每当有人输入URL < www.123.com/a 这个文件时,让我们说一个php文件(所以它是 a.php ),这样人们可以输入 www.123.com/a 而不是 www.123.com/a.php STRONG>。我该如何解决这个问题?



是否有一些独特的方式来保存文件,以便保存文件并且可以通过名称调用url?在我的情况下,如果我调用 www.123.com/a 它会说找不到对象的错误但它将适用于 www.123.com/a.php



如何隐藏.something部分在url栏中的一个文件?



其他笔记,我使用记事本,所以每当我保存我键入 a.php 保存为PHP或 a.js 用于javascript文件。


<通常这是通过 .htaccess 来完成的:



$ b

  RewriteEngine on 

RewriteCond%{REQUEST_FILENAME}!-d
RewriteCond%{REQUEST_FILENAME} .php -f
RewriteRule(。* )$ 1.php [QSA]


I have a question about removing the ending of a file in the url bar (the .something like .php, .html, .js, .asp part). My goal is such that whenever somebody is typing in the url something like www.123.com/a where the file is, let's say a php file( so it's a.php ) so that people can type in www.123.com/a instead of www.123.com/a.php. How do I fix this?

Is there some unique way to save files so that they are saved and can be called via the url just by its name? In my case, if I call www.123.com/a it will say "object not found error" but it will work for www.123.com/a.php.

How do I hide the .something part of a file in the url bar?

Additional notes, I use notepad so whenever I save I type in a.php as save as for PHP or a.js for javascript files.

解决方案

Typically this is done with .htaccess:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [QSA]

这篇关于删除以.php,.js,.asp等结尾的网址文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆