php security with url?


php security with url?

当我访问我的php网页然后它的url看起来http://hostname/mydir/index.php
但是我想保护我的网址,它应该看起来像http://hostname/virtual_dir1/virtual_dir2/mydir
请帮助我如何才能确保我的网页url。

谢谢你,

你应该在你的。htaccess中重写一个规则:
例:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^virtual_dir1/virtual_dir2/mydir /mydir/index.php

有关.htaccess重定向的更多信息,请参阅此处。
http://corz.org/serv/tricks/htaccess2.php

这与安全性无关,只是为了美观。您需要查看mod_rewrite(假设您正在使用Apache),并在.htaccess中使用RewriteRule。请看这里:

http://httpd.apache.org/docs/current/mod/mod_rewrite.html