Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Hide PHP filename in address bar


  • Please log in to reply

#1
Diego8

Diego8

    Member

  • Member
  • PipPipPip
  • 189 posts
In my website i have a php file used to submit e-mail and when the user does not write a valid e-mail address (or does not correctly complete some other fields) the php shows a run-time made html page with the fields that were not completed right.
The problem i'm having is that when this html page is displayed, the complete route and filename of the php file is displayed in the address bar.
Is there a way i can display another address insted of the php one?.

Thnaks in advance
  • 0

Advertisements


#2
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts
http://testomoz.org/...r_button/ff.htm
http://testomoz.org/tbutton/ff.php

If you try those links they both lead to the same page, even though though I don't have a folder called /toolbar_button/ or any thing with a .htm file extension. How this works is mod-rewrite, if you have an apache web server you can use this.

First make a file called .htaccess yep that is right it starts with a dot.

In this put

RewriteEngine on

This turns it on.

RewriteRule ^toolbar_button/ff.htm tbutton/ff.php

This would do the above rewrite. If you know regular expressions you can use this too to rewrite lost of urls that are similar.
  • 0

#3
Diego8

Diego8

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 189 posts
I tryed adding that to an .htaccess file but nothing changed.
Where should i put the .htaccess file? at / folder or in the same folder where the php file i want to rewrite is?.

This is my .htaccess file:

RewriteEngine on
RewriteRule ^error.html folder1/folder2/mail_error.php
  • 0

#4
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts
In the / folder. The .htaccess only applies to the current folder and all those below it.

It is possible that mod-rewrite is not enabled by your host, in which case this will not work. Try asking them.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP