question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mod-rewrite support

See original GitHub issue

Hi. I’d like to use this library in a MAMP project with mod-rewrite, so some assets files paths are not the same in the server and in the browser. For example: /assets/cache/css/styles.css in the browser is /assets/css/styles.css in the server. There can be also some files pointing to the same file (I have a css preproccessor that inject imported css) so some files in the server (for example: base.css, grid.css, etc) can be just one file in the browser. Is there any way to map the watched files to create alias between server and browser files?. Some like this (just an idea):

module.exports = {
    files: {
        "assets/cache/css/styles.css": [
            "assets/css/base.css",
            "assets/css/grid.css"
        ],
        "assets/cache/css/styles2.css": [
            "assets/css2/*.css"
        ]
    }
}

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jasonmorgansoncommented, May 18, 2014

You can do this using the connect-modrewrite middleware:

var modRewrite = require('connect-modrewrite');

server: {
  middleware: [
    modRewrite([
      '^[^\\.]*$ /index.html [L]'
    ])
  ]
}
0reactions
lessadiogocommented, Apr 24, 2017

@jasonmorganson , thats actually amazing! I’ve spent much time on it… Could you explain some details of regex… or give some reference? I got part of what u did, but not completely. Thanks for the solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mod_rewrite - Apache HTTP Server Version 2.4
Support Apache! Topics. Logging. Directives. RewriteBase; RewriteCond; RewriteEngine; RewriteMap; RewriteOptions; RewriteRule. Bugfix checklist.
Read more >
Apache mod_rewrite and Examples | HostGator Support
mod_rewrite can redirect one URL to another URL, rewrite requested URLs, limit access to your site and much more. A rewrite rule can...
Read more >
How to Rewrite URLs with mod_rewrite for Apache on Ubuntu ...
I have no questions. I plan to take this idea and extend it into a URL shortener/redirect service as a project. I am...
Read more >
Do you support Mod_Rewrite? - InMotion Hosting
Do you support Mod_Rewrite? ... The quick answer is yes! Mod_rewrite is a rule based rewrite engine that handles rewriting URL's on the...
Read more >
How to Configure mod_rewrite {With 5 Practical Examples}
mod_rewrite helps rewrite URLs. ... The mod_rewrite module does not prettify a URL. ... Restart the Apache service to apply the changes:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found