Is .json able to be used as an .htaccess?

It’s just a question, can a .json file be used as a .htaccess file? Or is a .json an .htaccess file?

htaccess is a specific config file type used by httpd (a.k.a Apache) and as far as I know it has to be in that INI-style format that you usually see for htaccess files.

Other web servers may be configurable with a JSON file.

If your site is a static site on Glitch, i don’t think it uses httpd. So a htaccess won’t work for you.

Can you share more about your needs?


How can htaccess be used on glitch?

@Orion_American_Gamin you can’t use htaccess on glitch but I want to learn what do you want.
maybe I can help

Hey there, sorry for the late response. I need a way to ban people on my site using IP addresses, and I need a way to get people’s IP addresses. Unless there is a way to do it without doing IP addresses, maybe logins.

Sadly I am not that talented.

people could just use a VPN to bypass it. i think putting a variable in .env, and setting up a login system might be better.

Wouldn’t I need cookies for that?

no, use .env. cookies can easily be viewed. hence, making it useless.

Once logged in, will the user be automatically logged in on the next visit, or when is refreshed?

Apologies for a lot of questions, I am just curious.

not really. but you could use a cookie for this. when the user logs in once, make a cookie with a random value, on the next visit, see if the cookie has the specified value.

This would be correct right?

function setCookie(name,value,days) {
    var expires = "";
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days*24*60*60*1000));
        expires = "; expires=" + date.toUTCString();

Yes it is off the internet, and yes I will give credit.

you’re not actually setting the cookie in the function. are you going to put it somewhere else?

1 Like


if you want to ban someone and you dont know how, you can always just use a whitelisting service that whitelists peoples ip.

In php it would be this:

$iphp = $_SERVER['REMOTE_ADDR'];
if($iphp = "IP ADRESSES HERE") {
echo("<iframe src="/home.html" width="100%" height="100%" frameBorder="0"></iframe>")
} else {
  header("Location: /banned.html");

or you can use sessions:

Set the sessions in the index.php file:

$iphp = $_SERVER['REMOTE_ADDR'];
if($iphp == "IPS HERE") {
$_SESSION["banned"] = "true";
} else {
$_SESSION["noban"] = "true";

and than reference the session on other pages (check for it and redirect if they are banned):

$noban = $_SESSION["noban"];
if($noban = "true") {
//dont put anything here if you want to display page, you can also use the echo() function to show page here
} else {
//function to trigger if they aren't whitelisted

Remember you can always use i-frames and mention files in your site like this ./path/path/filename but if someone realizes its an i-frame, they can manually enter site so maybe do the sessions example I gave you.

so sorry about how long this is, but I had some aspects I felt I needed to cover. It would mean a lot if you credit me if you use these examples. If you need I would be happy to implant some basic things onto your website such as these.