I have a small website where I have wrote some rules
RewriteEngine On
RewriteRule ^[!/.]*([A-Za-z0-9]+)/?$ /index.php?id=$1 [NC,L]
This redirects all of my links to example.com/index.php. Whereas I want them to redirect all the URLs with one directory example.com/dir to be redirected to this link example.com/index.php, and URLs with two directories, example.com/dir1/dir2 should redirect to example.com/index2.php, and rest should not be redirected.
you can use the below code .. i’ll explain it a little ..
http://www.example.com/customdir/index/1/
customdir = Your Sub Directory
index = index.php
1 = Your id