# Category: .htaccess

## Restrict url from direct access from browser in lumen

I want to disallow user to access video from direct url using bowser <video src=”MYURL” type=”video/mp4″ ><track src=”http://www.videogular.com/assets/subs/pale-blue-dot.vtt” kind=”subtitles” srclang=”en” label=”English”></video> Above code is correct but if someone copy MYURL from inspect element in browser and try to access in new tab with direct MYURL i want to restrict them to do so. Technology Frontend : angularjs Backend : lumen (api) Source: AngularJS

## reloading the deep route after removing the ‘#’ from url in express angular app throwing error

I tried to remove the hashtag from url in angular app. Issue: The redirection works perfectly if I first load the index page and then goto any route, however, it throws an error when I reload any deep route page directly. If I refresh any page : localhost:3001/about, It throws error however when I route from index page <a href=”/about”>About </a> it works. I checked many answers for modrewrite, however, none worked for me. In […]

## Access page secured by htaccess in chromium directly (angularjs error appears)

I experienced an strange error in angularjs when I use .htaccess (AuthType Basic) within chromium. If I access the page ‘in an normal way’ the user and password promt get shown from the browser. If I enter them angularjs (and the rest of the page) is working perfectly fine! But when I access the page with embedded credentials, e.g. like this: http://user:[email protected]/directory I get the following warnung: [Deprecation] Subresource requests whose URLs contain embedded credentials […]

## Angular 4 routing not working on vps server

After done the angular4 app “ng build –prod” and upload the production files to the “VPS server” then the angular app is running fine with routing. But whenever I reload some particular URL (e.g. example.io/register) and then I got the 404 page. I have solved this type of issue on the apache server with .htaccess. Can anybody help me how to deploy app correctly or there any suitable .htaccess? Source: AngularJS

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

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