This tutorial help to enable mod_rewrite in nginx server.The .htaccess
is not supported by Nginx server, So will implement URL routing into nginx using site virtual host file. The URL Rewrite use to make URLs Search Engine Friendly.
The mod_rewrite
module normally uses a rule-based rewriting engine to rewrite requested URLs based on PCRE regular-expression parser. By defaults mod_rewrite maps a URL to a filesystem path. It allows you to rewrite URL based on server variables, environment variables, HTTP headers, or time stamps.
The Apache server is supporting .htaccess
file. I have already shared How To Enable Mod_Rewrite Module In Apache
I am assuming you have CentOS machine and Nginx is installed on it. There are following steps will follow to implement URL rewrite rules –
Step 1: I am assuming you’re using the default.conf
file. We will open this file which is stored in /etc/nginx/conf.d/
folder –
Step 2: Search the below code into the virtual host file(default.conf).
location / { root /usr/share/nginx/html; index index.html index.htm; }
We will make following changes into the above line and save the file –
location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.php?$args; }
Step 3: We will reload Nginx server service using below command –sudo service nginx reload
Normally, web hosting provider install WordPress site into the sub folder(phpflow) then , We need to change location block as like below –
from –
location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; }
replace To –
location /phpflow/ { try_files $uri $uri/ /wordpress/index.php?$args; }
You need to restart nginx service or server.
This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More
in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More
This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More
We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More
in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More
I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More