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

When using browser-sync,why is the browser saying cannot get, while everything seems fine
How to sync the actions performed on webpage using Browsersync?
lite-server, BrowserSync: setting other URL path than /
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

Categories

HOME
merge
nvd3.js
zend-framework
jelastic
seo
newrelic
code-coverage
odoo-8
qpython
commonjs
3nf
bitnami
azure-powershell
poedit
visual-studio-extensions
mongoid6
tosca
monit
ckfinder
fable-f#
entity-relationship-model
inversion-of-control
tpm
paperjs
cppreference
gitlab-api
catch-unit-test
imx6
sim-toolkit
zoomify
flatmap
odroid
metaprogramming
azure-arm
levenshtein-distance
plr
drupal-theming
dtsearch
google-cse
azure-cli
sundials
reshape
libjpeg
cmp
pocketsphinx-android
simplepie
reporting-services-2012
tinkerpop3
udpclient
shopping
stream-processing
mediametadataretriever
bizagi
upx
halcon
jaunt-api
maybe
concurrentmodification
java-money
lasso
jdk1.7
vacuum
matlab-deployment
user-permissions
adehabitathr
viewer
cancellation
live555
malformedurlexception
wxformbuilder
alternate
memset
spring-remoting
mutual-authentication
gwt-openlayers
spring-3
scriptaculous
http-patch
asdf
kaleidoscope
css-reset
mantle
cascadingdropdown
idn
catransform3d
svk
cac
ie-compatibility-mode
instantiationexception
tabpanel
pagemethods
lemmatization

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