hey i want to encode my website url as a form of security but i have no idea how to go about doing so and help?

add this code within a javascript function?

Member Avatar for diafol

I'm unsure as to the use here. Could you give an example of what you're trying to accomplish?

is this the correct way the encode a browser url:

<script>
    function test()
    {

        $string= 'http://www.google.com';
        urlencode($string);
    }
</script>

Basically i have a website and i want to encode the url when it it shown in the browser.

No, you are mixing Javascript and PHP, not possible.

I think you misunderstand what URL encoding is. You can encrypt parts of an URL, but not the complete one. It's better if you explain WHY you want to do this.

basically i want to encode parts of the url when shown in the browser eg. mydomain.com/index.php. i wouldnt want the index.php to show. want use it as a means of security

Can you give an example of what you DO want to show, and how it should be processed?

With htaccess you can process all these with a single script, and do the decryption and redirect there. Am lost as to WHY you would want this.

as a form a security

Am not sure WHAT you are trying to secure. Just "securing" some URL parameters doesn't sound like a plan. If you are using sensitive data, use POST, and SSL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.