2017-05-18 31 views
0

如何使我的websits登錄表單頁面成爲「/ login」而不是「/login.php」或「 /login.html「像我的網站一樣只顯示目錄」/ login「。任何回覆和提示都很好。謝謝。如何顯示登錄表單'/ login'而不是'login.php'或'login.html'

+0

[Remove .php extension with .htaccess]可能的重複(http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess) –

回答

2

一個簡單的解決辦法是重命名「的login.php」到「的index.php」,並將其放置在它稱爲自己的文件夾「登錄」

0

我做到這一點與.htaccess - 這使得http://exmaple.com/whatever.php被看作是簡單的http://example.com/whatever

Options -MultiViews 
RewriteEngine on 

# skip all files and directories from rewrite rules below 
RewriteCond %{REQUEST_FILENAME} -d [OR] 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule^- [L] 

# add php if possible 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule^%{REQUEST_URI}.php [L] 

# rewrite other to index.php file 
RewriteRule^/index.php [L] 
0

要刪除.php.html擴展的URL並website.com/login.phpwebsite.com/login.html顯示器作爲website.com/login添加以下代碼的.htaccess文件中:

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*)$ $1.php 


RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.html -f 
RewriteRule ^(.*)$ $1.html 

</IfModule> 

(未測試)。

相關問題