Is it possible to implement permalink Structure in a Custom PHP Product? If so could someone guide me how to do so.
I have bunch of PHP Files where head.php is being called initially.
I have introduced a variable admin_id in all the SQL Statements and to introduce the variable in insert and select the command i have introduced the variable as admin_id='$admin_id' in SQL Statements.
I want the variable to be assigned on the basis of Permalink i.e. http://localhost/admin_id/page_name.php. Here the admin_name is the custom permalink variable in the custom structure and page_name.php is the. page in the /var/www/html folder
I would advise having all requests go through a single entry point which would then parse the URL and do the routing. I would suggest you check how Code Igniter handles routing. Most MVC frameworks use a similar principle. This way you are not dealing with so many rewrite rules in your .htaccess file.
In your .htaccess in your root folder you would have this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Then index.php would be responsible for loading a routing class and handling your requests. Your routing class could then have a map of URL patterns that you want and where you want to route them. Alternatively you can setup something similar to code igniter where http://domain.com/controllername/methodname will automatically route your to controllername->methodname().