help mod_rewrite php

0

I have a structure as follows:

  • index.php
  • .htaccess
  • assets
    • app.js
  • modules
    • main
      • default.php
    • demo
      • default.php

The .htaccess is:

RewriteRule ^([a-zA-Z0-9\_]+)/?([a-zA-Z]+)?$ index.php?module=$1&view=$2 [L,NC]

The index.php is:

<script src="assets/app.js"><script>
<?php
    $module = (isset($_REQUEST['module'])?$_REQUEST['module']:'main';
    $view = (isset($_REQUEST['view'])?$_REQUEST['view']:'default';
    include 'modules/'.$module.'/'.$view.'.php';
?>

When I enter the url index.php I have no problem, but when I enter the url main / default / can not find the file main / default /assets/app.js , I do not know what that is and how to solve it, thanks.

    
asked by jhuaraya 19.04.2016 в 16:01
source

1 answer

2

I do not think it has to do with mod_rewrite or the .htaccess, I think it's a matter of how you're calling the .js file, you're using a link relative to the current one, try with:

<script src="/app/assets/app.js"><script>
    
answered by 19.04.2016 в 16:10