I'm building a web app with Angular 1.x(not using ionic, building a website). I would like to remove the '#' from the URLs. I did implement html5mode true and put a base tag in the head tag in index.html. It works fine until I refresh the pages. When it is in html5mode it thinks that the URL is a request to the server. I'm developing in the local environment with gruntjs using the grunt-contrib-connect plugin and hosting my website in GoDaddy hosting in Linux Hosting Server. I would like to configure the html5mode(removing the hash from the URLs) in both environments(development and production). Note: I'm using ui.router with states if it matters in this problem.
Removing the hash from the url in AngularJS 1.x
357 views Asked by Cenk Yurtbilir At
1
There are 1 answers
Related Questions in JAVASCRIPT
- Using Puppeteer to scrape a public API only when the data changes
- inline SVG text (js)
- An array of images and a for loop display the buttons. How to assign each button to open its own block by name?
- Storing the preferred font-size in localStorage
- Simple movie API request not showing up in the console log
- Authenticate Flask rest API
- Deploying sveltekit app with gunjs on vercel throws cannot find module './lib/text-encoding'
- How to request administrator rights?
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- In Datatables, start value resets to 0, when column sorting
- How do I link two models in mongoose?
- parameter values only being sent to certain columns in google sheet?
- Run main several times of wasm in browser
- Variable inside a Variable, not updating
Related Questions in ANGULARJS
- How to automatically change path in angular when scrolling
- Error two clicks to be able to login Angular 16
- Passing an array of objects through the $http.post method in angular JS does not work
- Understanding how to apply Angular Signals from beginning on an existing service
- provider duplicate while compiling a Cordova application for the Android platform
- How can I use angularjs $parse service in Angular?
- Width of custom headers in ag-grid (angular) doesn't match with column's width
- Issues with Katex/ngx-markdown Rendering in Angular 16
- How to make Angular SSR wait for async operations to finish that are initiated in ngOnInit?
- I want to install @angular/google-maps npm Package in angular 16.2.12 but "npm install @angular/google-maps" this is not working/ tell me other query
- Angular 17 standalone application integrate CKEditor 5 -- Error: window is not defined
- Why is $scope >= 0 showing true in interpolation while empty in controller?
- The XMLHttpRequest compatibility library was not found
- Making Gantt Chart Column Labels More Readable
- Pass key-value pairs of object as individual arguments to component in Angular
Related Questions in GRUNTJS
- Failed to instantiate module ui-bootstrap for Angular after grunt serve
- Deploy Grunt on Vercel
- Grunt Handlebars partials name modification issue
- How do I create an entry point for my webpack.config.js in Angualr js
- Grunt project works when accessed from VSCode, but when deployed to Vercel, doesn't load JavaScript
- Grunt >> ReferenceError: primordials is not defined
- Not able to compile .less Magento 2.4.6-p2
- Warning: Uglification failed. Unexpected token: punc «:», expected: punc «,»
- Why does installing grunt(npm install grunt --save-dev) into my project stops in between and doesn't make any chnages to package.json?
- Throws SyntaxError while trying to run grunt build --env=devel --platform=android --crosswalk=false
- How can I include some specific css file in the prod grunt file?
- grunt-contrib-copy stops with EEXIST error
- Unable to install grunt in Windows 11 npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
- Mock a function called by child process in Jest
- Im new to laravel and trying to run an existing laravel project, when I run npm install so much "npm WARN deprecated" message appear
Related Questions in GRUNT-CONTRIB-CONNECT
- How to communicate port from grunt connect to grunt jasmine task
- How remove port number ":80" when serving localhost using grunt-contrib-connect
- grunt-contrib-connect/grunt-contrib-watch livereload: Refused to apply style from [path] because its MIME type
- Removing the hash from the url in AngularJS 1.x
- Is it possible to send http calls via grunt connect?
- What is grunt serve capable of doing with connect?
- What is the difference between grunt-connect and grunt-contrib-connect?
- grunt-contrib-watch with livereload with vs without grunt-contrib-connect
- Trouble running Qunit tests with static server using grunt
- How to change gruntfile and add proxy
- Getting Error POST http://localhost:8080/stub/cms/myalerts2.json 405 (Method Not Allowed)
- grunt-localscreenshots is getting Not Found error on rendered pages from grunt-contrib-connect
- Grunt: is there a way to load a determinate file or url, based on current path
- grunt-contrib-connect running but not working
- How can I use grunt to open Google Chrome and pass flags like --incognito?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
By default,
AngularJSwill route URLs with a hash(#).For example:
To remove the hashtag from the URL, you need to do two things
$locationProvider$location Service
In AngularJS, the
$locationservice parses the URL in the address bar and makes changes to application and vice versa.$locationProvider and html5Mode
We will use the
$locationProvidermodule and sethtml5Modeto true.We will do this when defining Angular application and configuring routes.
Setting Relative Links
To link around application using relative links, we will need to set a
<base>in the<head>of your document.There are many other ways to configure this and the
HTML5mode set to true should automatically resolve relative links.