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

Is it safe to include localhost into your connect-src for CSP?
Quit Browser-sync from terminal
lite-serverbs-config.js: middleware and array of folders
Make BrowserSync use the real https URL
Can we use browser sync on external url
How to replace .html with forward slash in BrowserSync?
Error during instillation of browser sync
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?

Categories

HOME
beautifulsoup
grok
developer-tools
themes
package
grafana
access
seo
static-site
xbee
boto3
nfs
modal-dialog
siddhi
tput
enterprise-architect
3nf
internationalization
standards
sigma.js
poedit
imagemap
gmock
definitelytyped
winexe
vex
realm-mobile-platform
magento-1.8
volatile
cognos-bi
left-join
sql-server-2000
kodi
laravel-eloquent
getpixel
pdw-file-browser
parse-tree
tasm
datacachefactory
http-request
servermanager
openrasta
podscms
remedy
payara-micro
dt
libjpeg
flyout
trigger.io
mathcad
renaming
simplepie
dimension
udpclient
data-protection
aurora
boost-serialization
nio2
dynatree
tfs-workitem
java-money
r-package
branch-and-bound
mirror
omnifaces
phpldapadmin
formview
tweenlite
android-audiorecord
spring-3
http-patch
time.h
dolby-audio-api
pclzip
cascadingdropdown
resource-management
device-width
sentestingkit
box2d-iphone
node-redis
xcelsius
creole
codebase
facebook-iframe
jqueryform
rowlex
pagemethods
todos
flvplayback

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