Home > OS >  editing .htaccess to direct the public/index.php fie in subdomain on share hosting Hostinger
editing .htaccess to direct the public/index.php fie in subdomain on share hosting Hostinger

Time:08-14

I am trying to figure out how to direct the .htaccess file in the root of my subdomain to the public/index.php file, so that the server will load the file. But I also lack any knowledge regarding with .htaccess file.

Trying to connect to

public_html/absolute/public/index.php

from

public_html/absolute/.htaccess

.htaccess file inside public_html/absolute

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^$ public/index.php [L]
    RewriteRule ^((?!public/).*) public/$l [L,NC]
</IfModule>

It would also be really helpful, if I was given any source to learn more about .htaccess file configuration for project deployment!

CodePudding user response:

I just found out that the files can be accessed throgh the www.doamin.com/subdomain/public link after deleting the .htaccess in the subdomain root folder. Goo luck guys!

CodePudding user response:

Try this code in public_html/absolute/.htaccess:

RewriteEngine On

RewriteRule ^$ public/index.php [L]
RewriteRule !^public/ public%{REQUEST_URI} [L,NC]

This will allow you to use https://www.coffeesojava.xyz/absolute/

  • Related