Search Posts

Category: apache

Where to install Angular on Apache?

First of all, my question is not about how to install angular. I’m just getting started with this framework and already got a question right at the beginning. Usually I create new web projects (HTML, PHP…) in the default web folder of the apache webserver (/var/www/). I did this with angular too under /var/www/firstAngularProject, but it seems the application itself is only accessible on its default port on the webserver root. In my case this […]

angularjs routing / html5mode and htaccess giving 404 error

I am building my first angularjs app in 1.6x and my router is resulting in a 404 errors my router looks like this: app.config(function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); $routeProvider .when(‘/account’, { templateUrl: ‘views/account/welcome.html’, }) //works .when(‘/account/emails’, { templateUrl: ‘views/account/email.html’, controller: ’emailController’ }) //404 error .when(‘/account/wallet’, { templateUrl: ‘views/account/wallet.html’, }) //404 error .when(‘/account/settings’, { templateUrl: ‘views/account/settings.html’, }) //404 error .when(‘/account/logout’, { templateUrl: ‘views/account/logout.html’, }) //404 error .otherwise({ redirectTo: ‘/’ }) //works }); and my htaccess looks like […]

AngularJS redirect to full URL from short URL from base

I have a web application built on AngularJS. Which uses ui-routing. I have user profiles on the website and they are long informative URLs. For example: https://example.com/#!/profile/fname-lname-some-other-descriptive-url Requirement: I want to create short URLs for profiles, New URL would be: https://example.com/username This short URL will redirect the user to the full URL. Basically, I want to create some kind of dynamic URL redirecting/mapping. I am not sure about how can I capture the parameters from […]

angular .htaccess 404 for html5mode

I am trying to make my urls looks like localhost/CLCAppV2/client/register rather than looking like ocalhost/CLCAppV2/client/index.html#/register So I configured my .htaccess like <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.html/$1 </IfModule> I then configured my angular config to look like $urlMatcherFactoryProvider.caseInsensitive(true); $locationProvider.hashPrefix(”); $urlRouterProvider.otherwise(‘/register’); $locationProvider.html5Mode({ enabled: true, requireBase: true }); I also have my html base url set in the index.html as <base href=”/CLCAppV2/client/”> My current folder structure looks like […]

Angular and symfony in one dir – htaccess

I have following problem, I have in folder /var/www/html 2 dirs: app (angular application) and api(restful api and cms written in symfony3). In both directories there is appropriate htaccess for each application. The document root is /var/www/html and I need the website to be redirected to app/index.html, and only /api/ to api subfolder. But I can’t get this working with symfony htaccess. Angular htaccess is default provided. Symfony htaccess: DirectoryIndex app.php <IfModule mod_rewrite.c> RewriteEngine On […]