.htaccess RewriteBase for development env not working

727 Views Asked by At

This is my .htaccess file

  RewriteEngine On

  RewriteBase /myapp_dev/

  RewriteCond %{REQUEST_URI} /index\.html$ [NC,OR]
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  RewriteRule ^(signup|signin)/?$ $1.html [L,NC]

  RewriteRule ^home/?$ signup.html [L,NC]

  RewriteRule . index.html [L]

And in my html pages, I have this

<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <base href="/">
</head>
<body>
  
  <!-- Something here -->
  
  
  <script src="public/libs/angular/angular.js"></script>
  <script src="public/libs/angular-resource/angular-resource.js"></script>
</body>
</html>

I am expecting the server to request for http://localhost/myapp_dev/public/libs/angular/angular.js

But it is requesting for this url which anyways doesn't exist.

http://localhost/public/libs/angular/angular.js

Any issues in .htaccess code?

1

There are 1 best solutions below

0
On

On development host create a new .htaccess in your site root and have an additional rule to handle these static paths:

RewriteEngine On

RewriteRule ^public/libs/.+$ /myapp_dev/$0 [L,NC,R=301,NE]