Showing posts with label url pass multiple variables on .htaccess. Show all posts
Showing posts with label url pass multiple variables on .htaccess. Show all posts

Angularjs htaccess html5mode rules

Angularjs  htaccess html5mode Rules


htaccess html5mode rules
htaccess html5mode rules

htaccess html5mode Rules Angularjs Create a site is very looking and linking root changed so create a htaccess file. more example htaccess

I have an angular application with several routes,
site.com/
site.com/page
site.com/page/3
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]

    RewriteRule ^(.*) /index.html [NC,L]
First you have to do is turn on HTML5 mode in your Angluar main or module's config page.

Copy and Paste for the following Code and add your code.
angular.module('main', []).config(['$locationProvider', function($locationProvider) {  
  ...
  $locationProvider.html5Mode(true);
  ...
});

htacces page redirect and 404 page not found and index page redirect 301, and 302 temporary redirect and  permanent  redirect code follows

  RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested pattern is file and file doesn't exist, send 404
RewriteCond %{REQUEST_URI} ^(\/[a-z_\-\s0-9\.]+)+\.[a-zA-Z]{2,4}$
RewriteRule ^ - [L,R=404]

# otherwise use history router
RewriteRule ^ /index.html

url pass multiple variables on .htaccess

 In this post I want to explain about URLs rewriting techniques using .htaccess file. Friendly URLs looks neat on the browser address bar.



RewriteRule extraurl/(.*).html currentsite.php?id=$1 [L,QSA]

RewriteRule ^extraurl/(.*).html subayurveda.php?aid=$1 [L,QSA]

url pass multiple variable
 url pass multiple variables on .htaccess


RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?keys=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?keys=$1


<?php

$keys=$_GET['keys'];

if($keys=='home')
{
include('home.php'); // Home page
}
else if($keys=='login')
{
include('login.php'); // Login page
else if($keys=='terms')
{
include('terms.php'); // Terms page
}
else 
{
include('users.php'); // Users Gateway
}
?>

Multipul Value:

htaccess code:

RewriteRule ^([\da-z]+)/([\da-z]+)/(\d+)/?$ index.php?category=$2&language=$1&id=$3 [L,QSA,NC]
RewriteRule ^([\da-z]+)/([\da-z]+)/?$ index.php?category=$2&language=$1 [L,QSA,NC]

php code:

print($_REQUEST);
exit;

output:

category = Value and Language = Value and id