browser-sync


How to replace .html with forward slash in BrowserSync?


I am developing website using BrowserSync. However, in the production version, I will be replacing .html with forward slash via .htaccess . Is it possible to achive the same result using BrowserSync?
You can start your browsersync with next server config:
server: {
baseDir: "./build",
serveStaticOptions: {
extensions: ['html']
},
middleware: function(req, res, next) {
var url = req.url;
if (url.length > 1 && url[url.length-1] === "/") {
req.url = url.slice(0, url.length - 1);
}
return next();
}
}
Not perfect solution, but if you go to http://foo/bar/ instead http://foo/bar.html it will not cause get error.

Related Links

Gulp and Browsersync injecting CSS but causing a full reload
Browser-sync - serve “node_modules” out of “src” directory
[browser-sync]browser-sync proxy can't connect to Rails Application
Browserstack not serving index.html by default
whatever i do i can't access the external URL for the site or UI
How do I kill browserSync before creating it?
Unable to install browser-sync on windows 7
browser-sync proxy fails to connect
What's the equivalent bs-config.js (Browsersync) of this command?
How to quit the browser-sync server, or how to know the running server pid
browsersync not working (note: not using gulp)
Using browsersync with gulp/nodemon
BrowserSync Not Reloading Changes
Setup browser-sync to serve routes from absolute directories on windows
Browser-sync writes in console «Reloading Browsers …», but update is not happening. Why?
SSL chain of trust with browser-sync?

Categories

HOME
shell
api
fuelux
requirements
seo
parameters
hugo
bookmarks
odoo-8
computer-science
arangodb
dkim
windows-ce
why3
x-cart
frequency-distribution
flash-player
selectize.js
android-intent
symbol
html5-appcache
sencha-touch
systemtime
google-api-client
jquery-multiselect
angularjs-components
amazon-quicksight
bioinformatics
uitapgesturerecognizer
testcomplete
database-comparison
joomla2.5
batching
getlasterror
servicestack-text
reason
lint
playframework-2.1
modernizr
connection-pool
naming
apollostack
strftime
procfile
textsum
dtsearch
insight
podscms
google-cse
tinkerpop
edit
excel-dna
sundials
arules
mouseleave
flac
py2neo
filenet
meteor-packages
segment-io
dotnetnuke-7
riot
uiactionsheet
file-move
roadkill-wiki
video-player
zen-cart
slash
mod-proxy
fits
variadic-templates
android-cookiemanager
trdion2011
ios8-extension
multiautocompletetextview
artemis
gd-graph
hidapi
cffile
cmmi
superscrollorama
stacky
intersect
frameworkelementfactory
qtconcurrent
urlrewriter
workflow-services
matlab-load
timthumb
qglwidget
metaweblog
objective-j
undefined-index
load-time
object-database
rowlex
silverlight-oob
asynchronous-wcf-call
windows-identity
perl5.12
blind

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App