Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,469
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Look at .htaccess rewrite rules ...

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


    .

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,469
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    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.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #7
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,469
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    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.

  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    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.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #9
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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

  • #10
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 Attached Thumbnails Hide/remove address bar URLs for PHP application-oracle_webbased_app.jpg  

  • #11
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    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.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #12
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's OK. I might be in the wrong forum section.

    Oracleguy, could you please move this thread to Apache configuration?

  • #13
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •