I had an wordpress site active for one year. Url was like example.com/dev. Now I am gonna move it to example.com. So I want if someone use /dev to get access to any pages I want him to redirect removing that string. if a previous URL was example.com/dev/country/canada now this URL should redirect to example.com/country/canada
You can use following rule in your .htaccess file:
RewriteEngine On
RewriteRule ^dev/(.*)$ /$1 [L,R=301]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]
Add below code in your .htaccess
Options +FollowSymLinks
Options -Indexes
RewriteEngine on
DirectoryIndex index.php
RewriteRule ^dev /dev.php
RewriteRule ^dev/country/canada/(.*) /canada.php?id=$1