简体   繁体   中英

loading php pages with out .php extension

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM