2016-12-05 100 views
0

我在localhost有這個路徑(localhost/ams/forms/login.php)。當我輸入localhost/ams時,我想重定向爲乾淨的網址(localhost/ams/forms/login/)。我想用ht訪問重定向到一個乾淨的URL?

+0

嘿,夥計們!我有這個項目,重定向到localhost/ams/forms/login.php,當我在瀏覽器localhost/ams上輸入時重定向。我嘗試使用htaccess的一個乾淨的網址,但我研究了很多,但沒有回答幫助完成乾淨的網址,或者只是我不想顯示.php文件擴展名? – carth

+4

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

回答

0

這清晰.PHP從URL

RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L] 

這個從舊文件路徑重定向到新的文件路徑

Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html 
+0

感謝您的答案,但我正在尋找更乾淨的網址 – carth

+0

當你想輸入(localhost/ams)..重定向到(localhost/ams/forms/login /) – knizer