Search Posts

Category: .htaccess

Reconfigure htacces file

Could someone please configure my .htaccess file, to reload the page when adding a new path? I need it to work also with angularJS 1 routing. RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ – [NC,L] RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::$ RewriteRule ^(.*) – [E=BASE:%1] RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] Thanks in advantage Source: AngularJS

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 […]

How to solve the CORS issue when the endpoint doesn’t accept OPTIONS method?

I’m building mobile client apps for easily manage Magento E-commerce store, I;m using the Token Based authentication here , I’m using ionic2 for my mobile framework. My problem is, The angular HTTP is sent OPTIONS request instead of POST to /V1/integration/admin/token endpoint that produce 400 bad request because the endpoint doesn’t support the OPTIONS method. here my code : import { Injectable } from ‘@angular/core’; import { Http, Headers, RequestOptions } from ‘@angular/http’; import ‘rxjs/add/operator/map’; […]

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:!/profile/fname-lname-some-other-descriptive-url Requirement: I want to create short URLs for profiles, New URL would be: 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 […]

Does setting html5Mode to true no longer make my website a single page application?

In AngularJS if you want to get rid of the ‘#’ in the url, you set html5Mode to true. But then this sends a request to the server for the page, no longer making it a single page application, is this correct? The way I can tell this is because when I comment out setting the html5Mode to true, the ‘#’ is in the url and my website works as a single page application. But […]

Deny all but only allow access from Angularjs on the same server

I have a Lumen backend and an Angularjs project on the same server without a virtual host. The way I access APIs is simply by the URL like I want to hide these endpoints from the public but only allow access from the Angularjs. I tried adding this to the .htaccess in the api/public folder, Order deny,allow Deny from all Allow from But Angular will be denied as well. I access the endpoint […]

400 Bad Request during magento 2 REST API Call

When using $http.get in angular, I have a problem: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource….. $http({ method: ‘GET’, url: ‘https://<magento_host>/rest/default/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=status&searchCriteria[filter_groups][0][filters][0][value]=processing,pending&searchCriteria[filter_groups][0][filters][0][condition_type]=in’, headers : { ‘Authorization’: ‘Bearer xxxxxxxxxxxxxxx’ } }).success(function (data) { }).error(function (data) { }); To avoid cross origin issue, I set below method in .htaccess file in Apache server. Header always set Access-Control-Allow-Origin “*” Header always set Access-Control-Allow-Methods “POST, GET, OPTIONS, PUT, DELETE” Header always set Access-Control-Allow-Headers: Authorization In […]

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 […]

SLIM php Angularjs CORS

I’m using SLIM framework as backend and Angularjs as frontend.Normal GET and POST API’s is working fine.Whenever i pass the headers in GET or POST method it is throwing 404 error.I used the .htaccess file for CORS. RewriteEngine On # Some hosts may require you to use the `RewriteBase` directive. # If you need to use the `RewriteBase` directive, it should be the # absolute physical path to the directory that contains this htaccess file. […]

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 […]