Allow html tags and files only to particular page URL using php

Must Read : Allow html tags and files only to particular page URL using php

We are mostly using header and footer as separate page. so that time when we are adding one in header or footer file it will affect all the files that, so for we have to take that files only to the particular url, then only it will works well. we can add css, javascript and jquery to particular page. so her we have only solution for that. simple php code will help you to do this. lets see the code.
To find server name

The above code Output is like

www.wearecoders.net

i run this code in my demos site so my output will be like

To know the current requsting URL

It will show the current requesting page. if you are running this code in demos.wearecoders.net/url/url.php means the output will be like.

/url/url.php

Consider There are 3 files.
index.php
main.php
url.php

INDEX.PHP

the above code is the index file code. this code will runs in all the pages.

MAIN.PHP

URL.PHP

so the above INDEX.PHP code runs in all the page.

is getting the current url by the concatenation operator of both SERVER_NAME and REQUEST_URI.  We are checking that by using if(condition). if the url path is correct it will run. like the above index.php file code you can give if condition as you need.

NOTE : Don’t use HTTP:// or HTTPS:// it wont accept. i hope this is really helpful to you.

(Visited 17 times, 1 visits today)

Leave a Comment.