dimanche 25 octobre 2020

How rewrite base to support inclusion of php files using htaccess

I have php website (in development) which I has following structure

httpdocs
  + myweb.com 
      + assets
         + css
            + style.css
         + includes
            + config.php
      + admin
          + home.php
      + home.php

PROBLEM

I am including css in /home.php as ..

<head>
     <link href="assets/css/styles.css" rel="stylesheet" />
</head>

above is working. Now I wanted same link to be working in /admin/home.php

<head>
     <link href="assets/css/styles.css" rel="stylesheet" /> <!-- Not working -->
</head>                                                     <!-- This wanted -->

<head>
     <link href="../assets/css/styles.css" rel="stylesheet" /> <!-- working -->
</head>

I want a mechanism where file url should start from base. like if I set base to myweb.com, then css inclusion should valid for /assets/css/style.css in any of file irrespective of location. I tried base rewrite but that is not helping

I tried

RewriteBase /myweb.com/
DirectoryIndex home.php  

Platform : XAMPP for Linux




Aucun commentaire:

Enregistrer un commentaire