Reputation: 11
I use my own php mvc My htaccess:
php_flag display_errors on
php_value error_reporting 9999
RewriteEngine On
RewriteBase /sekilwak/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
How to rewrite "domain.com/user/index/username" to "domain.com/username"
Upvotes: 0
Views: 1219
Reputation: 3765
First method is through .htaccess
file you can write rewrite rules -
Write the following code in .htacces
file in your project root directory
RewriteEngine on
RewriteRule ^/username/(.*)$ /user/index/username/$1 [R=301,NC,L]
You can Also Use Apache Rewrite Module -
If you are using CodeIgniter you can use Steps and code as below -
Then open routes.php
go to end of file and add code below
$route['username']="user/index/username";
It will automatically add domain.com
to both side url's
Upvotes: 2