开发者

loading php pages with out .php extension

开发者 https://www.devze.com 2023-01-19 11:08 出处:网络
I\'m new to php and I have created a simple site using php5. my question is I have a page called login.php , when I type http:///login.php, the page loads

I'm new to php and I have created a simple site using php5. my question is

I have a page called login.php , when I type http:///login.php, the page loads

But what I want to do is to load 开发者_运维知识库the page without giving the .php extension , as follows

http:///login

Can I do like this, I'm running on apache2 and hoping to publish my site in a shared environment

thanks in advance

cheers sameera


Create .htaccess file in root folder.

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{SCRIPT_FILENAME} !-d
   RewriteRule ^([^\.]+)$ $1.php [NC,L]
</IfModule>
0

精彩评论

暂无评论...
验证码 换一张
取 消