473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Hide Url

51
Hi all,
I would like to hide my url to other for secuiry purpose.

i have page like:

http://localhost/cstc/index.php

i dont want to show my users the page extension.i want to show my user:

http://localhost/cstc/

how can i do this?
Sep 20 '06 #1
7 27183
Hello,

U do this with the help of .htaccess concept.

U have to define rule that if url is

http://localhost/cstc/index.php

then its give url http://localhost/cstc/.

Plz. try to use .htaccess concept

Bye
Sep 20 '06 #2
I have an option for you..
just replace your url by duplicate url
means
STEP1 -> take the current url by $_SERVER['PHP_SELF']

STEP2 -> AND REPLACE IT BY YOUR URL(WHICH U LIKE)

bye
pasu
Sep 20 '06 #3
tbb9216
16
here is the code for an .htaccess file to do what youre asking:
Expand|Select|Wrap|Line Numbers
  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteCond    %{REQUEST_FILENAME}  !-f
  4. RewriteCond    %{REQUEST_FILENAME}  !-d
  5. RewriteRule . /index.php [L]
  6.  
this turns on the mod_rewrite engine in apache, tells what base directory to look in, checks the files to see if they exist, and if they dont, it will default to /index.php and you can use the URL as variable using $_SERVER['REQUEST_URI'] and explode

youll need to do this for each directory you want to have work, otherwise they will all go back to /index.php

good luck,
-tim
Sep 23 '06 #4
mainul
51
Hi,

i am working under windows environment and i am novice in php. i am using apche2traid to run my apache server. i could not catch ur solutions. can anyone help me giving the whole sample code?
Sep 23 '06 #5
tbb9216
16
http://php.net/htaccess to learn about this in php
http://us2.php.net/reserved.variables and find info on REQUEST_URI

since you are using windows, you cant create a .htaccess file because windows wont allow a file starting with a period. so you need to edit your apache.conf file to look for a different file name than .htaccess.

now that that is ready, creat that file with the info i put in my last post. if your apache document root is c:/php/ then in the .htaccess the / will point to that.

so what the htaccess file does is turns on apache mod_rewrite, and tells it that if the file in the URI doesnt exist (eg: http://localhost/fakedirectory ), it will display your index.php for your document root. if you HAVE a directory called 'fakedirectory', it will show the index.php file for that directory. you can place an htaccess file in fakedirectory as well, and start stacking them up so it wouldnt go back to your document root.

back to using mod_rewrite...

if you have it point back to / and you go to http://localhost/fakedirectory, it will show /index.php and will set the variable $HTTP_SERVER_VARS['REQUEST_URI'] to /fakedirectory. if you went to http://localhost/fakedirectory/anotherfake it would set $HTTP_SERVER_VARS['REQUEST_URI'] to /fakedirectory/anotherfake, which you can then call and explode to break it at the / into seperate vars to work with.

sorry this is wordy, but i dont know how it cant be

-tim
Sep 23 '06 #6
mainul
51
Hi guys,
thanks for ur solutions. i got another way to solve the problem. below codes also work. just save the code as index.htm and keep it in the folder. the page name will not show. dont remove the index.php file.

best regards.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<HTML>
<HEAD>
<TITLE>Customer Enquiry</TITLE>
</HEAD>
<FRAMESET cols="100%">
<FRAME src="http://localhost/cust/index.php">
<NOFRAMES>
<P>This frameset document contains:
<UL>
<LI><A href="http://localhost/cust/">A link to mysite</A>
</UL>
</NOFRAMES>
</FRAMESET>
</HTML>
Sep 24 '06 #7
your html link:
Expand|Select|Wrap|Line Numbers
  1. <a href="www.example.com/item/harddisk">Hard disk</a>
Your .htaccess
Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^item/(.*)$ products.php?name=$1
Your products.php
Expand|Select|Wrap|Line Numbers
  1. $name=$_GET['name']
Jan 10 '14 #8

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

Similar topics

5
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main...
3
by: alex | last post by:
I'd like to have a show/hide widget on my web site, kind of like "show details" / "hide details" in Google Groups. Is there a tutorial explaining how to make them? Google's is a bit complex and...
0
by: Efkas | last post by:
I have a full custom application with some widged extending Controls like Label and PictureBox. I build a menu with these widgets. When I click on one of them, it calls a function to display...
7
by: FP | last post by:
I'm new to Java Script. I'm displaying comments people have made. Below each persons' comment I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would display an empty text field...
5
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of...
1
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. ...
6
by: Ralph | last post by:
Hi, I was reading effictive C++ and some other books again and they all tell you about hiding implementation details (proxy/pimpl/inheritance) but they never really explain when to use it. I...
6
by: Doogie | last post by:
Hi I have an img control I am trying to hide upon certain types of commands in my code behind. When to hide it is directly tied to a asp:dropdownlist control. So depending on what the user...
2
by: richard | last post by:
In using the simple code below, how do I tell it NOT to hide a division when the link is clicked on if that division is already visible? would it be as simple as using a 2nd function and setting...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.