cách ẩn tên tệp php trên thanh địa chỉ bằng .htaccess

lập trình


# CASE SENSITIVE METHOD

Options -Indexes 
# quick custom error "document"..
ErrorDocument 404 "<html><head><title>NO!</title></head><body><h2><tt>There is nothing here.. go away quickly!</tt></h2></body></html> 


Options +FollowSymlinks
RewriteEngine on
RedirectMatch /$ http://192.168.1.25/shrineyog/index.html

# Pass Through the empty request (to be handled as DirectoryIndex)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /?\ HTTP
RewriteRule .? - [PT]

# If index or index.php requested, strip and redirect
RewriteCond %{THE_REQUEST} index(\.php)?
RewriteRule ^index(\.php)?$ http://www.example.com/ [R=301,L]

# Remove PHP extension from links if NOT subrequest
RewriteRule ^(.+)\.php$ $1 [R=301,NS]

# Serve PHP extension from links
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ /$1.php [L]

tôi sử dụng mã này. Nhưng nó không hoạt động bình thường. Vui lòng sửa mã này hoặc cung cấp một số mã khác

[Edit]Đã thêm định dạng khối mã[/Edit]

Giải pháp 1

Bạn không thể ẩn bất cứ điều gì khỏi địa chỉ xấu bằng cách sử dụng .htaccess hoặc bất kỳ thứ gì khác. Đây là thành phần phía máy khách, không có gì trong ứng dụng Web có thể truy cập vào trình duyệt.

Tuy nhiên, bạn có thể sử dụng, đặc biệt, những thứ như Viết lại URLđây là điều hoàn toàn khác, nhưng nó có thể giúp bạn: http://en.wikipedia.org/wiki/URL_rewriting[^].

Nếu đây là thứ bạn muốn, hãy xem xét công cụ tuyệt vời này để giúp bạn viết .htaccess phù hợp:

[^].

-SA

コメント

タイトルとURLをコピーしました