Php 如何更改浏览器搜索字段中的引用

Php 如何更改浏览器搜索字段中的引用,php,html,apache,Php,Html,Apache,这是html代码: <html> <head> <title>Test page</title> </head> <body> <form action="modules/registration/registration.php" method="POST"> <input type="submit" />

这是html代码:

<html>
    <head>
        <title>Test page</title>
    </head>
    <body>
        <form action="modules/registration/registration.php" method="POST">
            <input  type="submit" />
        </form>
    </body>
</html>

测试页
这是registration.php代码:

<?php
    echo "<p>Registration is completed!</p>";
?>

如果我按下按钮,一切都能按我的需要进行。但我不想显示内部文件夹结构。在浏览器搜索字段中,如下图所示

我希望在浏览器搜索字段中,参考如下所示:

这是文件夹结构:


我该怎么做?谢谢您的帮助。

您可以使用
.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^registration.php modules/registration/registration.php
</IfModule>

重新启动发动机
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^registration.php模块/registration/registration.php

使用htaccess,您可以
重写URL以删除文件夹URL并仅显示registration.php

.htaccess文件

RewriteEngine on
RewriteCond %{REQUEST_URI} !^modules/registration/
RewriteRule ^(.*)$ modules/registration/$1 [L]
因此,结果将是

myurl.com/registration.php

使用.htaccess您可以执行此操作..请查看