我要刪除我的文件.php
如果有人寫.php
不工作是這樣的:如果用戶將.php
=>不工作或重定向到home
如何從URL中刪除.php,如果添加.php,則無法工作?
這是我.htaccess
www.example.com/home.php => www.example.com/home
網址:
RewriteRule ^home$ home.php
我要刪除我的文件.php
如果有人寫.php
不工作是這樣的:如果用戶將.php
=>不工作或重定向到home
如何從URL中刪除.php,如果添加.php,則無法工作?
這是我.htaccess
www.example.com/home.php => www.example.com/home
網址:
RewriteRule ^home$ home.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
你的.htaccess
並非所有,我想要特定的網址 – AboYousef16
內你必須有阿帕奇活躍mod_rewrite
模塊
.htaccess文件:
<IfModule mod_rewrite.c>
# Enable RewriteEngine
RewriteEngine on
RewriteBase/
RewriteCond% {SCRIPT_FILENAME}! -d
RewriteCond% {SCRIPT_FILENAME}! -f
# Rewrite URL requested by the user
# IN: ID-NAME
# Output: example.php? Id = ID
RewriteRule^([0-9] +) \ - ([a-zA-Z0-9 -] *) $ example.php? Id = $ 1
</ IfModule>
問候
這看起來像一個重複:HTTP://計算器。 com/questions/4026021/remove-php-extension-with-htaccess – MannfromReno
[Remove .php extension with .htaccess]可能重複(http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess ) – Croises