好吧,我使用PHP做網站,沒有任何框架(我是新手),所以我看到很多網站都是這樣的:
我的問題是,我怎樣才能在我的網站上這樣做?我從我的地址中洗掉了 我只是想把
編輯*。另外,是否有辦法從我所有的php檔案( 這是我的 uj5u.com熱心網友回復: 這段代碼還洗掉了所有.php擴展名。你可以修改它,將它們重定向到你網站上的一些錯誤頁面。
標籤:example.com/example?example1=example2?
example.com/example? example1=example2
index.php,但我的網站顯示出這樣的請求:myweb.com/myweb/?example1=example2
/放在?標記前。我應該怎么做?謝謝你的幫助:)index.php和example.php)中永久洗掉.php擴展名?
.htaccess檔案內容:Options FollowSymLinks -MultiViews
打開mod_rewrite
重寫引擎開啟
RewriteBase /
RewriteCond %{REQUEST_FILENAME}! !-f
RewriteCond %{REQUEST_FILENAME}! !-d
RewriteRule ^(.*)$ index.php?1 [L,QSA]
RewriteCond %{THE_REQUEST}! ^[A-Z]{3,}s(.*)/index.php [NC]
RewriteRule ^ %1 [R=301,L)
Options FollowSymLinks -MultiViews
# 開啟mod_rewrite
開啟重寫引擎(RewriteEngine)
RewriteBase /
##隱藏.php擴展名
#從外部將/dir/foo.php重定向到/dir/foo
RewriteCond%{THE_REQUEST} ^[A-Z]{3,}s([^.] ).php [NC]
RewriteRule ^ %1 [R=302,L)
# 在內部將/dir/foo轉發給/dir/foo.php
RewriteCond %{REQUEST_FILENAME}! !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ 1.php [L]
