I want to get the item URL without any directory name,
e.g. https://www.example.com/item_id
Keep in mind that the fileitem_id is not the actual file name; it should look like a query string but without?.
I have actual file names like about.php, privacy-policy.php, login.php, terms-of-use.php and many more.
I have tried this
RewriteEngine On RewriteRule ^([0-9a-zA-Z-]+)/([0-9a-zA-Z-/-]+)$ controller.php?item_id=$1&item_code=$2 [L]
Keep in mind that the default page of the website is index.php
There is another file name called controller.php and this file is included inside the index.php file
So the index.php file looks like <?php indlude(/controller.php);?> only.
And this code was works well as this
https://www.example.com/item_id/item_code
The problem here is that I just want to look item_id at
So when I tried this, RewriteRule ^([0-9a-zA-Z-/-]+)$ items-controller.php?$1&item_id=$1 [L]
worked well too, but theabout-us.php file and other actual files are not used as actual files; they are used as the item_id too. So I can either redirect them or stop them. What can I do to let the .htaccess look the actual file first? If there is no actual file like about-us.php file then.htaccess file should take the file (item_id) as anitem_id.
Now to demonstrate When user enters to https://www.example.com the server should look at the index.php page by default, then if the user enters to https://www.example.com/about-us then the server should go straight to the about us page, and for others actual page too, but if the user enters https://www.example.com/item_id then the server first see if there is an actual file name with this, if not found then let the server see it as a query string. then I can look it up in the MySQL database.
NOTE: item_id can be numeric/letters or both.
Thank you in advance.