How to remove .php, .html, .htm extensions with .htaccess

How to remove .php, .html, .htm extensions with .htaccess

What is an .htaccess file
An .htaccess file may be a simple ASCII file that you simply create with a text editor like Notepad or TextEdit. The file lets the server know what configuration changes to form on a per-directory basis.

Please note that .htaccess is that the full name of the file. It isn’t file.htaccess, it’s simply .htaccess.

.htaccess files affect the directory during which they’re placed in and every one children (sub-directories). for instance if there’s one .htaccess file located in your root directory of yoursite.com, it might affect yoursite.com/content/, yoursite.com/content/images/, then on…

It is important to recollect that this will be bypassed. If you don’t want certain .htaccess commands to affect a selected directory, place a replacement .htaccess file within the directory you don’t want to be affected with the changes, and take away the precise command(s) from the new file.

Features
With an .htaccess file you can:

Redirect the user to different page
Password protect a selected directory
Block users by IP
Preventing hot-linking of your images
Rewrite URLs
Specify your own Error Documents
In this tutorial we’ll be focusing only on rewriting URLs.

Removing Extensions
To remove the .php extension from a PHP file for instance yoursite.com/wallpaper.php to yoursite.com/wallpaper you’ve got to feature the subsequent code inside the .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

If you would like to get rid of the .html extension from an HTML file for instance yoursite.com/wallpaper.html to yoursite.com/wallpaper you merely need to change the last line from the code above, to match the filename:

RewriteRule ^([^\.]+)$ $1.html [NC,L]

That’s it! you’ll now link pages inside the HTML document without having to feature the extension of the page. For example:

wallpaper
Adding a trailing slash at the top
I received many requests asking the way to add a trailing slash at the top, for example, yoursite.com/page/

Ignore the primary snippet and insert the code below. the primary four lines affect the removal of the extension and therefore the following, with the addition of the trailing slash and redirecting.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Link to the HTML or PHP file an equivalent way as shown above. Don’t forget to vary the code if you would like it applied to an HTML file rather than PHP.

For Example

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^location/([0-9a-zA-Z_]+) job-by-city.php?city=$1
RewriteRule ^category/([0-9a-zA-Z_]+) job-by-category.php?category=$1

RewriteRule ^openings/([0-9a-zA-Z_]+)/([0-9a-zA-Z_]+) jobs-link.php?city=$1&category=$2

RewriteRule ^details/([0-9]+) job-details.php?jdid=$1

ErrorDocument 404 /404.php

RewriteRule ^jobs-in-delhi?$ jobs-in-delhi.php

Some people asked how you’ll remove the extension from both HTML and PHP files. I don’t have an answer for that. But, you’ll just change the extension of your HTML file from .html or .htm to .php and add the code for removing the .php extension.

How to Increase the Maximum File Upload Size in WordPress

How to Check Your Maximum File Upload Size Limit in WordPress?

WordPress will automatically show the utmost file upload size limit once you are uploading images or media. to see it you’ll simply attend Media » Add New page and you’ll see the utmost file uplaod size limit for your WordPress site.

1: Theme Functions File

There are cases where we have seen that just by adding the following code in theme’s functions.php file, you can increase the upload size:

@ini_set( 'upload_max_size' , '32M' );
@ini_set( 'post_max_size', '32M');
@ini_set( 'max_execution_time', '300' );

htaccess Method

Some people have tried using the .htaccess method where by modifying the .htaccess file in the root directory, you can increase the maximum upload size in WordPress. Edit the .htaccess file in your WordPress site’s root folder and add the following code:

1
2
3
4
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
how to remove .php extension from url in php

how to remove .php extension from url in php

remove .php extension from url in php

Just follow these steps

Open .htacess file and copy below code in .htacess file

 
RewriteEngine On

RewriteRule ^test?$ test.php

Here test is your page name
Now you can visit your page like abc.com/test

remove ?id from url in php

if your url is user.php?id=1
then just copy the below code in your htacess file
RewriteEngine On

RewriteRule ^user/([0-9]+) user.php?id=$1



RewriteRule ^test?$ test.php

RewriteRule ^user/([0-9]+) user.php?id=$1


RewriteRule ^shop/cat/([0-9a-zA-Z]+)/subcat/([0-9a-zA-Z]+) shop.php?cat=$1&subcat=$2




  That’s It. Now you see a magic in your url    
active class using php In 5 Minutes

active class using php In 5 Minutes

You can simply follow steps and add active class in your navigation using PHP

Step1:  In Header page Modified navigation link as per your need

<li class=”nav-item <?php if ($phpSelf==”index.php”) { echo “active”; } ?>”><a href=”index.php” class=”nav-link”>Home</a></li>
<li class=”nav-item <?php if ($phpSelf==”about.php”) { echo “active”; } ?>”><a href=”about.php” class=”nav-link”>About</a></li>
<li class=”nav-item <?php if ($phpSelf==”menu.php”) { echo “active”; } ?>”><a href=”menu.php” class=”nav-link”>Menu</a></li>
<li class=”nav-item <?php if ($phpSelf==”blog.php”) { echo “active”; } ?>”><a href=”blog.php” class=”nav-link”>Stories</a></li>
<li class=”nav-item <?php if ($phpSelf==”contact.php”) { echo “active”; } ?>”><a href=”contact.php” class=”nav-link”>Contact</a></li>
<li class=”nav-item cta”><a href=”reservation.php” class=”nav-link”>Book a table</a></li>

Step2: Open particular page like index.php,about.php so on..

Step3: Add these code before including header.php

$phpSelf = trim(basename($_SERVER[‘PHP_SELF’]));

That’s It. Now you can see your navigation link has active class

Thanks. Basant Mallick

Razorpay payment gateway integration in php

Razorpay payment gateway integration in php

Web development is the coding or programming that enables website functionality, per the owner’s requirements. It mainly deals with the non-design aspect of building websites, which includes coding and writing markup.

Web development ranges from creating plain text pages to complex web-based applications, social network applications and electronic business applications.

The web development hierarchy is as follows:
Client-side coding
Server-side coding
Database technology

Web development refers to building, creating, and an maintaining websites. It includes aspects such as web design, web publishing, web programming, and database management.

While the terms “web developer” and “web designer” are often used synonymously, they do not mean the same thing. Technically, a web designer only designs website interfaces using HTML and CSS. A web developer may be involved in designing a website, but may also write web scripts in languages such as PHP and ASP. Additionally, a web developer may help maintain and update a database used by a dynamic website.

Web development includes many types of web content creation. Some examples include hand coding web pages in a text editor, building a website in a program like Dreamweaver, and updating a blog via a blogging website. In recent years, content management systems like WordPress, Drupal, and Joomla have also become popular means of web development. These tools make it easy for anyone to create and edit their own website using a web-based interface.

While there are several methods of creating websites, there is often a trade-off between simplicity and customization. Therefore, most large businesses do not use content management systems, but instead have a dedicated Web development team that designs and maintains the company’s website(s). Small organizations and individuals are more likely to choose a solution like WordPress that provides a basic website template and simplified editing tools.

NOTE: JavaScript programming is a type of web development that is generally not considered part of web design. However, a web designer may reference JavaScript libraries like jQuery to incorporate dynamic elements into a site’s design.

Client SIde

Payment Page

Paytm Payment Gateway Integration Using PHP

Paytm Payment Gateway Integration Using PHP

Integrate Payments with Paytm

Add Paytm Payment Gateway to your mobile app or website. Collect online payments from your customers using UPI, Debit/Credit Cards, 50+ NetBanking options and Paytm Wallet.

Paytm IS A PAYMENT PROCESS SYSTEM, I WILL INTEGRATE Paytm WITH WEBSITES BY USING WITH PHP

Just follow below steps:

Step1: First, we need to create an account at https://business.paytm.com/ and get our merchant ID and Secret Key.

Now we can start coding in our site to use the Paytm. First, we will configure the Paytm with test credentials to test our code.

freelance php developer in delhi ncr india

Step 2. (filename – config.php)

<?php
/*

– Use PAYTM_ENVIRONMENT as ‘PROD’ if you wanted to do transaction in production environment else ‘TEST’ for doing transaction in testing environment.
– Change the value of PAYTM_MERCHANT_KEY constant with details received from Paytm.
– Change the value of PAYTM_MERCHANT_MID constant with details received from Paytm.
– Change the value of PAYTM_MERCHANT_WEBSITE constant with details received from Paytm.
– Above details will be different for testing and production environment.

*/
define(‘PAYTM_ENVIRONMENT’, ‘TEST’); // PROD
define(‘PAYTM_MERCHANT_KEY’, ‘**********’); //Change this constant’s value with Merchant key downloaded from portal
define(‘PAYTM_MERCHANT_MID’, ‘**********’); //Change this constant’s value with MID (Merchant ID) received from Paytm
define(‘PAYTM_MERCHANT_WEBSITE’, ‘**********’); //Change this constant’s value with Website name received from Paytm

/*$PAYTM_DOMAIN = “pguat.paytm.com”;
if (PAYTM_ENVIRONMENT == ‘PROD’) {
$PAYTM_DOMAIN = ‘secure.paytm.in’;
}

define(‘PAYTM_REFUND_URL’, ‘https://’.$PAYTM_DOMAIN.’/oltp/HANDLER_INTERNAL/REFUND’);
define(‘PAYTM_STATUS_QUERY_URL’, ‘https://’.$PAYTM_DOMAIN.’/oltp/HANDLER_INTERNAL/TXNSTATUS’);
define(‘PAYTM_STATUS_QUERY_NEW_URL’, ‘https://’.$PAYTM_DOMAIN.’/oltp/HANDLER_INTERNAL/getTxnStatus’);
define(‘PAYTM_TXN_URL’, ‘https://’.$PAYTM_DOMAIN.’/oltp-web/processTransaction’);*/

$PAYTM_STATUS_QUERY_NEW_URL=’https://securegw-stage.paytm.in/merchant-status/getTxnStatus’;
$PAYTM_TXN_URL=’https://securegw-stage.paytm.in/theia/processTransaction’;
if (PAYTM_ENVIRONMENT == ‘PROD’) {
$PAYTM_STATUS_QUERY_NEW_URL=’https://securegw.paytm.in/merchant-status/getTxnStatus’;
$PAYTM_TXN_URL=’https://securegw.paytm.in/theia/processTransaction’;
}
define(‘PAYTM_REFUND_URL’, ”);
define(‘PAYTM_STATUS_QUERY_URL’, $PAYTM_STATUS_QUERY_NEW_URL);
define(‘PAYTM_STATUS_QUERY_NEW_URL’, $PAYTM_STATUS_QUERY_NEW_URL);
define(‘PAYTM_TXN_URL’, $PAYTM_TXN_URL);

?>

Step 3. Now we will create a new file(index.php) to create the payment form which will have the amount to be paid and other needed information –

<?php
header(“Pragma: no-cache”);
header(“Cache-Control: no-cache”);
header(“Expires: 0″);
include(‘header.php’);
include(‘container.php’);
?>
<div class=”container”>
<h2>Example: Paytm Payment Gateway Integration in PHP</h2>
<br>
<br>
<form method=”post” action=”pgRedirect.php”>
<table border=”1″>
<tbody>
<tr>
<th>S.No</th>
<th>Label</th>
<th>Value</th>
</tr>
<tr>
<td>1</td>
<td><label>ORDER_ID::*</label></td>
<td><input id=”ORDER_ID” tabindex=”1″ maxlength=”20″ size=”20″
name=”ORDER_ID” autocomplete=”off”
value=”<?php echo “ORDS” . rand(10000,99999999)?>”>
</td>
</tr>
<tr>
<td>2</td>
<td><label>CUSTID ::*</label></td>
<td><input id=”CUST_ID” tabindex=”2″ maxlength=”12″ size=”12″ name=”CUST_ID” autocomplete=”off” value=”CUST001″></td>
</tr>
<tr>
<td>3</td>
<td><label>INDUSTRY_TYPE_ID ::*</label></td>
<td><input id=”INDUSTRY_TYPE_ID” tabindex=”4″ maxlength=”12″ size=”12″ name=”INDUSTRY_TYPE_ID” autocomplete=”off” value=”Retail”></td>
</tr>
<tr>
<td>4</td>
<td><label>Channel ::*</label></td>
<td><input id=”CHANNEL_ID” tabindex=”4″ maxlength=”12″
size=”12″ name=”CHANNEL_ID” autocomplete=”off” value=”WEB”>
</td>
</tr>
<tr>
<td>5</td>
<td><label>txnAmount*</label></td>
<td><input title=”TXN_AMOUNT” tabindex=”10″
type=”text” name=”TXN_AMOUNT”
value=”1″>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td><input value=”CheckOut” type=”submit” onclick=””></td>
</tr>
</tbody>
</table>
* – Mandatory Fields
</form>

</div>
<?php include(‘footer.php’);?>

 

Step 4. Here in form, we have set the action=”Redirect.php”, so we will create a new file with this name –

<?php
header(“Pragma: no-cache”);
header(“Cache-Control: no-cache”);
header(“Expires: 0”);
// following files need to be included
require_once(“./lib/config_paytm.php”);
require_once(“./lib/encdec_paytm.php”);

$checkSum = “”;
$paramList = array();

$ORDER_ID = $_POST[“ORDER_ID”];
$CUST_ID = $_POST[“CUST_ID”];
$INDUSTRY_TYPE_ID = $_POST[“INDUSTRY_TYPE_ID”];
$CHANNEL_ID = $_POST[“CHANNEL_ID”];
$TXN_AMOUNT = $_POST[“TXN_AMOUNT”];

// Create an array having all required parameters for creating checksum.
$paramList[“MID”] = PAYTM_MERCHANT_MID;
$paramList[“ORDER_ID”] = $ORDER_ID;
$paramList[“CUST_ID”] = $CUST_ID;
$paramList[“INDUSTRY_TYPE_ID”] = $INDUSTRY_TYPE_ID;
$paramList[“CHANNEL_ID”] = $CHANNEL_ID;
$paramList[“TXN_AMOUNT”] = $TXN_AMOUNT;
$paramList[“WEBSITE”] = PAYTM_MERCHANT_WEBSITE;

$paramList[“CALLBACK_URL”] = “http://phpzag.com/demo/paytm-payment-gateway-integration-in-php/pgResponse.php”;
$paramList[“MSISDN”] = 7777777777; //Mobile number of customer
$paramList[“EMAIL”] = “[email protected]”; //Email ID of customer
$paramList[“VERIFIED_BY”] = “EMAIL”; //
$paramList[“IS_USER_VERIFIED”] = “YES”; //
//Here checksum string will return by getChecksumFromArray() function.
$checkSum = getChecksumFromArray($paramList,PAYTM_MERCHANT_KEY);

?>
<html>
<head>
<title>Merchant Check Out Page</title>
</head>
<body>
<center><h1>Please do not refresh this page…</h1></center>
<form method=”post” action=”<?php echo PAYTM_TXN_URL ?>” name=”f1″>
<table border=”1″>
<tbody>
<?php
foreach($paramList as $name => $value) {
echo ‘<input type=”hidden” name=”‘ . $name .'” value=”‘ . $value . ‘”>’;
}
?>
<input type=”hidden” name=”CHECKSUMHASH” value=”<?php echo $checkSum ?>”>
</tbody>
</table>
<script type=”text/javascript”>
document.f1.submit();
</script>
</form>
</body>
</html>

To handle the response of return call from paytm we need another file(Response.php) –

<?php
require_once("config.php");
require_once("encdec_paytm.php");

$paytmChecksum = "";
$paramList = array();
$isValidChecksum = "FALSE";

$paramList = $_POST;
$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; //Sent by Paytm pg

SafexPay Payment Gateway Integration Using PHP

SafexPay Payment Gateway Integration Using PHP

About SafexPay

SafexPay is the brand from PayGate having multiple payment solutions like white label payment gateways for banks and institutions and provides an all-inclusive payment gateway solution to merchants. SafexPay also provides Prepaid wallet platform , UPI solution, Recharge Solution, Offline Payments Like email, SMS and QR code based payments. Some of our unique product offerings are advanced Integration API for best success ratios, Dynamic Currency Conversion (DCC), Push Response Technology, Dynamic Switching, Retry options, Advanced Analytics, Recurring Payments, Multiple Currency Options, Omni-Channel Offering, E-Wallet & M-commerce etc. SafexPay aims to build digital payments businesses and platforms- Encompassing payment gateways, payment aggregation (through a PSP setup), mobile wallets , White-Label Solutions as well as to provide value added services in the payments domain to consumers, merchants, banks and financial institutions across the globe.

SAFEXPAY is a payment process system, I will integrate SAFEXPAY with websites by using with php

Basant Mallick

Secured By miniOrange