veinhorn
veinhorn

Reputation: 2403

How to change the reference in browser search field

This is the html code:

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

This is the registration.php code:

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

If I push button all works as i need. But i wouldn't like show the internal folder structure. In browser search field it looks like on the picture below.

enter image description here

I would like that in the browser search field the reference looks like following:

enter image description here

This is the folder structure:

enter image description here

How can I do this? Thank you for any help.

Upvotes: 0

Views: 63

Answers (2)

Yotam
Yotam

Reputation: 358

Using htaccess you can Rewrite the URL to delete folder url and show only registration.php.

.htaccess file

RewriteEngine on
RewriteCond %{REQUEST_URI} !^modules/registration/
RewriteRule ^(.*)$ modules/registration/$1 [L]

So the result will be

myurl.com/registration.php

Upvotes: 1

Dipesh Parmar
Dipesh Parmar

Reputation: 27364

You can do this using .htaccess

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

Upvotes: 1

Related Questions