Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-01-2011, 09:56 AM   PM User | #1
campionelu
New to the CF scene

 
Join Date: Aug 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
campionelu is an unknown quantity at this point
Question Hide/remove address bar URLs for PHP application

Hello:

I developed an PHP application (WAMPserver) which will run on a company's internal server, and I want to hide/remove the URLs shown in the browser's address bar.

For example, the address bar

instead of:
http://apps.compania.es/application/rap_calendar.php

to show:
http://apps.compania.es/application/


I've read the Apache URL Rewriting Guide, but I couldn't see the solution to my problem.

Could anyone give me a clear example - solution?
campionelu is offline   Reply With Quote
Old 08-01-2011, 01:19 PM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Look at .htaccess rewrite rules ...

http://www.google.com/#sclient=psy&h...w=1024&bih=606


.
mlseim is offline   Reply With Quote
Old 08-01-2011, 04:17 PM   PM User | #3
campionelu
New to the CF scene

 
Join Date: Aug 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
campionelu is an unknown quantity at this point
I've tried many of those examples, but I couldn't find the RewriteRule for my situation.

I was hoping someone here could give me a clear solution.

I just want to hide the URL link that appears in the address bar, not to redirect.
campionelu is offline   Reply With Quote
Old 08-01-2011, 04:21 PM   PM User | #4
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Change the name of rap_calendar.php to index.php

Or if you already have index.php, 'include' rap_calendar inside of it.

Do everything with "index.php" ...
That way, you can hide all of the necessary URL variables.

EDIT:

Example,
http://apps.compania.es/application/?p=2

That would display the rap_calendar.php script, and you
would use .htaccess to hide the ?p=2 part.
Basically, you're building a template to display all pages using "index.php".

.

Last edited by mlseim; 08-01-2011 at 04:25 PM..
mlseim is offline   Reply With Quote
Old 08-01-2011, 04:37 PM   PM User | #5
campionelu
New to the CF scene

 
Join Date: Aug 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
campionelu is an unknown quantity at this point
I think this would require rewriting the application...
I'll consider it for the next one.

For now, maybe there is a simpler solution at server level.
campionelu is offline   Reply With Quote
Old 08-01-2011, 04:52 PM   PM User | #6
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,504
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Not really. As mlseim says, using index means that it can be invisble in the address bar as the server will automatically look for an index file itself.

All you need to do is use index.php and then include your normal file - as msleim says above. It's literally like this:

PHP Code:
include('usual-file.php'); 
Thats it. Any $_POST, $_GET, $_SERVER etc will still be available to your included file.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 08-01-2011, 06:41 PM   PM User | #7
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
And you should be using one script for all pages (index.php) ...
because it would allow you to display any information from
your database without creating a new page for each category (or whatever).

What is your site about? And if it's what you gave in post #1, it looks like
you already have a database, and lots of information.
mlseim is offline   Reply With Quote
Old 08-01-2011, 07:20 PM   PM User | #8
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,504
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by mlseim View Post
And you should be using one script for all pages (index.php) ...
because it would allow you to display any information from
your database without creating a new page for each category (or whatever).
This is exactly how I also write code. Everything goes through index.php where the request is then broken down and analyzed before being put through to other code via included files. I never use seperate files for main code as it becomes too confusing to update them all and remember to check/set variables etc.

All you need is a mode value in the url to tell the script which file to include (eg ?mode=login would include login.php). Job done.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 08-02-2011, 05:49 AM   PM User | #9
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Why exactly are you wanting to do this? Generally speaking there are very few reasons to obfuscate the URL the user is at. It can make it hard or impossible to bookmark pages or send people links. And depending on the implementation the browser's back and next buttons won't function properly.

Based on the response in your other thread it sounds like you think it isn't as clean or something to have the actual URL. You can do some rewriting but making the URL constant the entire time is just annoying for users due to the problems I listed above.

Hiding the URL doesn't make your application any more secure or more professional looking.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 08-02-2011, 08:25 AM   PM User | #10
campionelu
New to the CF scene

 
Join Date: Aug 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
campionelu is an unknown quantity at this point
Thank you all for your input.

I see you are an `OracleGuy`, so I give you this example. An Oracle Web-based application (see atachement) has the same address bar display no matter what module / form / report the user is in (http://aplic.compania.es:8889/forms90/f90servlet?...).

I want my PHP Web-based application to run the same way.

I'm sure this can be done, but I don't know how.
I need advice from some of your PHP developers members with application experience.

I posted a similar thread on the Apache configuration section, because I feel this can be done at server level.
Attached Thumbnails
Click image for larger version

Name:	Oracle_WebBased_App.jpg
Views:	66
Size:	48.8 KB
ID:	10136  
campionelu is offline   Reply With Quote
Old 08-02-2011, 10:10 AM   PM User | #11
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,504
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by campionelu View Post
I'm sure this can be done, but I don't know how.
So you don't know how but you're sure it can be done? - Yet you refuse to listen to those of us with experience?

Quote:
Originally Posted by campionelu View Post
I need advice from some of your PHP developers members with application experience.
We've given it to you.

The only other thing you can do is switch to using frames in your html but that is a html issue not for php.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 08-02-2011, 12:02 PM   PM User | #12
campionelu
New to the CF scene

 
Join Date: Aug 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
campionelu is an unknown quantity at this point
It's OK. I might be in the wrong forum section.

Oracleguy, could you please move this thread to Apache configuration?
campionelu is offline   Reply With Quote
Old 08-02-2011, 10:34 PM   PM User | #13
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Quote:
Originally Posted by campionelu View Post
Thank you all for your input.

I see you are an `OracleGuy`, so I give you this example. An Oracle Web-based application
Wrong use of the word, by 'oracle' its meant to be the dictionary definition of the word, not a reference to Oracle products.

Quote:
Originally Posted by campionelu View Post
Oracleguy, could you please move this thread to Apache configuration?
Sure thing.
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Reply

Bookmarks

Tags
hide url, php application

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:52 PM.


Advertisement
Log in to turn off these ads.