473,591 Members | 2,871 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to hide file name from URL?

kamill
71 New Member
I need to hide name of web pages from URL, I need to show only domain name of web site, and want to hide the name of web pages after slash.
Example
insteade of www.mysiteabc.c om/anyfile.php, i need to show only www.mysiteabc.c om.
Thanking in advance.

Regards:
Kamill
May 14 '07 #1
5 60626
pbmods
5,821 Recognized Expert Expert
I need to hide name of web pages from URL, I need to show only domain name of web site, and want to hide the name of web pages after slash.
Example
insteade of www.mysiteabc.com/anyfile.php, i need to show only www.mysiteabc.com.
I'm afraid that's not possible. If a script could change the text in the location bar in a User's browser, you could create a pharming page that looks like, for example, eBay.com's login page and then change the location bar text to eBay's login URL.

Without looking at the source, nobody would be able to tell that the site was a phony.

Now, one option you do have is to create a landing page from which you could obfuscate your page names. Something like this:

landing.php
Expand|Select|Wrap|Line Numbers
  1. switch($_GET['page']) {
  2.     case '001':
  3.         include('/pages/home.php');
  4.         break;
  5.  
  6.     case '002':
  7.         include('/pages/search.php');
  8.         break;
  9.  
  10.     .
  11.     .
  12.     .
  13.  
  14.     default:
  15.         include('/pages/404.php');
  16.         break;
  17. };
  18.  
Note that you can even store the source files outside of your document root (such as in the example above) to prevent Users from accessing your source files directly.

E.g., to get to the homepage, a User would have to go to:
http:// mysiteabc.com/landing.php?pag e=001
May 15 '07 #2
adamalton
93 New Member
You can kind of hide file names by using folders instead.

So instead of www.mysite.com/myfile.php
use
www.mysite.com/myfolder

Then in myfolder name your file index.html. If it needs to be a php file then you can change your webserver to treat .html as .php. (If you're using Apache it's something called 'Apache file handlers'.) It doesn't really make any difference to your other .html files because if php doesn't find any <?php tags ?> in the file then it will just treat it as html. Or you could set your webserver to treat .htm files as php but treat .html as html.

I hope that helps (though it probably doesn't!!)
May 15 '07 #3
shidec
26 New Member
it can be tricked.
Use frame !!!
I got this ideas from phpPgAdmin,
but with small correction

Main frame (index.html):
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Sistem Informasi Pembayaran - Universitas Negeri Yogyakarta</title>
  6. </head>
  7. <frameset rows="*,0" frameborder="no" border="0" framespacing="0">
  8.   <frame src="index.php" name="mainFrame" id="mainFrame" />
  9.   <frame src="dummy.html"></frameset>
  10. <noframes><body>
  11. </body>
  12. </noframes></html>
  13.  
Make sure your web server call index.html first than index.php
in apache, it can be configured at httpd.conf

dummy.html is an empty .html page

Add this script to the real pages (ex: index.php),
better put it in one .js file that can be called from all pages.
Expand|Select|Wrap|Line Numbers
  1. function cekParent(){
  2.     if(top.mainFrame==null){
  3.         window.open("/","_top");
  4.     }
  5. }
  6.  
function of that script is call main frame if user try to call index.php directly.
address bar will only show www.yourdomain.com
May 16 '07 #4
devsusen
136 New Member
Hi,

hiding the page name from URL is not a good option to follow. I prefer u should change file name. But the process of doing is bit complex one. All u need to do is to use a common script to modify the file name in that comes in the request and call the script from .htaccess. I forgot to say u need to LAMP.

susen
May 16 '07 #5
Motoma
3,237 Recognized Expert Specialist
You can use mod_rewrite to modify URLs on the fly.
You can use a frame, as was previously suggested.
You can do something trickier, such as store the page in your $_SESSION variable, and immediately redirect to / which will automagically pick index.php which should then read the $_SESSION page and load the correct information.
May 16 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

21
18203
by: ryanmhuc | last post by:
I know the subject might be confusing. I am no beginner with javascript but I haven't been able to figure out how to get the javascript file name from code inside the file. So you have an HTML doc with script tag who's source is a javascript file. <HTML> <script src="javascript.js"></script> </HTML> Javascript.js
2
11491
by: Jurjen de Groot | last post by:
Hello, Is there someway to hide the name of the page in the browser? When a page is display the full address is shown like http:\\www.mysite.com\Default.aspx, is there some setting (maybe in IIS / ASP.NET or something) so the page is shown like http:\\www.mysite.com\ and not showing aspx and possbile parameters. TIA
0
3197
by: jjalexrayer | last post by:
How do hide page name in address bar? This is my task. every programmer displaying every page name on Address bar. for example C://inetpub/wwwroot/project1/sample.aspx . instead of this url i want to display like C://inetpub/wwwroot/project1/ . how it is possible? Any one can help me..... Thanks, J.Alexander.
5
6149
by: Eric Davidson | last post by:
I keep getting the folowing error message in my db2diag.log every couple of seconds, and I can not find any information on this on the DB2 website or in the apr's Can anyone give me a pointer why this is happening. PS I only noticed this once I had migrated to v9 db2level DB21085I Instance "DB2" uses "32" bits and DB2 code release
14
3643
by: tuananh87vn | last post by:
hi, I see that it's easy to create a navigation like index.php?id=1, index.php?id=2... then you can hide the current part you are in. But I need a further step (as I've seen many), hope it's easy enough, that how can hide the file name index.php so that the above links become simple "?id=1, ?id=2... if so, that'd be great :)
1
2326
by: laadpiyush | last post by:
hello everyone m piyush.m doing project based on files handling.i want to hide file though java.do anyone hav idea how it can be possible? thanx
4
7939
by: carmelo | last post by:
Hi! I need to read and store data from a file, but I don't the name of it; Is this code correct and is there a better way to do this thing?? int main() { cout << " type file name:" char * name; cin >name;
185
6953
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will return the file name given a FILE *. Questions: What would be the best name for this function?
4
2941
by: liberty1 | last post by:
Hi everyone. I appreciate your effort at helping newbies like me. I have the following problems and will appreciate urgent help. PROBLEM NUMBER 1: Using PHP and MySQL, I am able to upload picture successfully unto the server but not so with the file name of the picture even though other parameters in my form got inserted successfuly in the database. I have read several posts on this topic including here on this site but I can't get around...
0
7870
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8362
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7992
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5400
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3850
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1465
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.