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

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 means the output will be like.


Consider There are 3 files.


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



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.