Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I encrypted my url link in php
PHP
$link =base64_encode('page2.php')

<form id="test" action="<?php echo $link;?>" method="post">


like this but when i run this code it shows

the requested url "http://localhost/Code/Report%20s/trR42JWpCV1ncxbuD0Gv8vFsMsn6//FVmZ5XNQp1glo=" was not found in this server



this is what i want to show in the address bar is ok but how to show 'page2.php' content in browser? without show "/page2.php" in address bar

Thanks in advance
Posted
Updated 27-Dec-19 0:10am
Comments
Sergey Alexandrovich Kryukov 28-Apr-14 3:15am    
Why? why?!
—SA
Arun2012 28-Apr-14 3:19am    
Just for hide my file name and extension in address bar
Mitchell J. 28-Apr-14 3:22am    
Why would you hide it? I agree with SA...
Arun2012 28-Apr-14 3:24am    
i want to hide the extension for plain & neat address bar
Sergey Alexandrovich Kryukov 28-Apr-14 3:46am    
You must be joking. "Neat" with base64? :-)

Then I answered. Please see Solution 2.<br>
—SA

You have to use URL rewriting for that - if you're using Apache, this should help: http://httpd.apache.org/docs/2.4/rewrite/[^]

You should bear in mind that URL rewriting is usually used to make URLs more readable and therefore better for search engines. What you are trying to do makes it even less readable.
 
Share this answer
 
Base64 is not "encryption": http://en.wikipedia.org/wiki/Base64[^].

The question makes no sense, because, before the HTTP request even reach your PHP processing code, this URL will fail already, because the HTTP server just sees the URL of the resource which does not exist. You don't need to decode this URL, you need to use some URL which can be interpreted by HTTP in some usable way.

As your purpose remains mysterious to me (what could it give you?!), I can only suggest you to think about different techniques of modifying URLs: URL rewriting or URL routing:
http://www.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting[^],
http://www.phpaddiction.com/tags/axial/url-routing-with-php-part-one[^].

You can also think of having URL parameters and encoding them, or combine these techniques. As I don't understand your purpose, I cannot advice anything in particular.

—SA
 
Share this answer
 
Comments
Arun2012 28-Apr-14 3:46am    
Thanks for the link
http://www.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting[^],

RewriteEngine On
RewriteRule test.php Xu8JuefAtua.php


In my local system httpd.config won't work
Sergey Alexandrovich Kryukov 28-Apr-14 3:49am    
Why? I guess this is Apache, which does support URL rewrite.
Anyway, are you going to accept the answer formally (green "Accept" button). This is what you really can use.
—SA
Arun2012 28-Apr-14 3:52am    
Which server support URL rewrite?
Any other possibilities in Apache server?
Sergey Alexandrovich Kryukov 28-Apr-14 3:54am    
Why other?
—SA
Arun2012 28-Apr-14 4:02am    
Sorry misunderstanding.
But it wont work on my local server, this is my www root
http://localhost/Code/Reports/test.php
there are several files named test.php inside http://localhost/ now i want to rewrite
this http://localhost/Code/Reports/test.php file how to define it in httpd.config?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900