Search Posts

Category: .htaccess

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 www.example.com/api/public/get_some_data. 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 127.0.0.1 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 […]