Hướng dẫn hide php from url - ẩn php khỏi url

Có một số cách để làm điều đó.

Bạn có thể sử dụng mod-rewrite để tua lại foo đến foo.php để yêu cầu /thanh được xử lý bởi /bar.php.

Sandaimespaceman tại Gmail Dot Com ¶

Sandaimespaceman tại Gmail Dot Com ¶

Sandaimespaceman tại Gmail Dot Com ¶

Sandaimespaceman tại Gmail Dot Com ¶

JTW90210 ¶

Bryce Nesbitt tại rõ ràng.com

Ryan ¶

10 năm trước

# Make PHP code look like other code types
AddType application/x-httpd-php .asp .py .pl

Omolewastephen tại Gmail Dot Com ¶

4 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t

STH tại Panix Dot Com ¶

Raz ¶

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html

14 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
17

Không thể ẩn hoàn toàn mã nguồn PHP vì nó là ngôn ngữ được giải thích, nhưng có một vài lựa chọn thay thế có thể: sử dụng mã obfuscator để làm cho mã nguồn khó đọc. Sử dụng bộ bảo vệ mã hoặc bộ mã hóa.

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.

.htaccess:

RewriteEngine on

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Một tùy chọn khác, nếu bạn muốn thực hiện việc viết lại URL của mình hoàn toàn PHP, là đặt các quy tắc viết lại để hướng tất cả các yêu cầu đến một tập lệnh duy nhất. Một lợi thế lớn của điều này, là bạn có thể lưu trữ mã của mình trong một khu vực không thể truy cập được đối với Apache và chỉ có tập lệnh URL của bạn mới cần phải được Apache truy cập.

Nói chung, bảo mật bằng cách tối nghĩa là một trong những hình thức bảo mật yếu nhất. Nhưng trong một số trường hợp, mỗi chút bảo mật thêm là mong muốn.

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
1

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
2

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
3

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
4

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Một vài kỹ thuật đơn giản có thể giúp che giấu PHP, có thể làm chậm một kẻ tấn công đang cố gắng khám phá những điểm yếu trong hệ thống của bạn. Bằng cách đặt expose_php thành off trong tệp php.ini của bạn, bạn giảm lượng thông tin có sẵn cho họ.

18 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
6

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
7

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Simon tại carbontweledesign dot co dot uk ¶

16 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
9

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
0

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
1

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
2

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
3

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
4

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
5

PHP tại vfmedia dot de ¶

JTW90210 ¶

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
6

Bryce Nesbitt tại rõ ràng.com

18 năm trước

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
7

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html
8

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Simon tại carbontweledesign dot co dot uk ¶

16 năm trước

off0

off1

off2

off3

off4

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

PHP tại vfmedia dot de ¶

20 năm trước

off6

off7

off8

off9

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

PHP tại net dot người dùng ¶

JTW90210 ¶

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.1

Một vài kỹ thuật đơn giản có thể giúp che giấu PHP, có thể làm chậm một kẻ tấn công đang cố gắng khám phá những điểm yếu trong hệ thống của bạn. Bằng cách đặt expose_php thành off trong tệp php.ini của bạn, bạn giảm lượng thông tin có sẵn cho họ.

19 năm trước

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.2

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.3

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.4

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.5

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.6

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.7

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.8

So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.9

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

benjamin at sonntag dot fr ¶

17 năm trước

.htaccess:1

.htaccess:2

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

thông tin tại frinteractives dot com ¶

7 năm trước

.htaccess:4

.htaccess:5

.htaccess:6

.htaccess:7

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

l0rdphi1 tại liquefyr dot com ¶

19 năm trước

.htaccess:9

RewriteEngine on0

RewriteEngine on1

RewriteEngine on2

RewriteEngine on3

RewriteEngine on4

RewriteEngine on5

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

m1tk4 tại hotmail dot com

20 năm trước

RewriteEngine on7

RewriteEngine on8

RewriteEngine on9

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

PHP tại net dot người dùng ¶

18 năm trước

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
1

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
2

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
3

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
4

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Simon tại carbontweledesign dot co dot uk ¶

16 năm trước

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
6

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
7

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
8

# Rewrite /foo/bar to /foo/bar.php
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
9

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
0

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
1

PHP tại vfmedia dot de ¶

18 năm trước

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
2

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
3

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
4

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
5

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
6

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
7

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
8

# Return 404 if original request is /foo/bar.php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
9

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
0

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Simon tại carbontweledesign dot co dot uk ¶

17 năm trước

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
2

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
3

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
4

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
5

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
6

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Bryce Nesbitt tại rõ ràng.com

19 năm trước

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
8

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]
9

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
00

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
01

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Ryan ¶

10 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
03

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
04

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
05

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Omolewastephen tại Gmail Dot Com ¶

4 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
07

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
08

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
09

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
10

# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

STH tại Panix Dot Com ¶

20 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
13

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
14

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
15

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Raz ¶

14 năm trước

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
17

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
18

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
19

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
20

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
21

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
22

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
23

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
24

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
0

Không thể ẩn hoàn toàn mã nguồn PHP vì nó là ngôn ngữ được giải thích, nhưng có một vài lựa chọn thay thế có thể: sử dụng mã obfuscator để làm cho mã nguồn khó đọc.Sử dụng bộ bảo vệ mã hoặc bộ mã hóa., but there are a few possible alternatives: Use a code obfuscator to make the source code difficult to read. Use a code protector or encoder.

Một tùy chọn khác, nếu bạn muốn thực hiện việc viết lại URL của mình hoàn toàn PHP, là đặt các quy tắc viết lại để hướng tất cả các yêu cầu đến một tập lệnh duy nhất.Một lợi thế lớn của điều này, là bạn có thể lưu trữ mã của mình trong một khu vực không thể truy cập được đối với Apache và chỉ có tập lệnh URL của bạn mới cần phải được Apache truy cập.set rewrite rules to direct all requests to a single script. One great advantage of this, is you can store your code in an area not accessible to Apache, and only your URL dispatching script need be Apache-accessible.