Reputation: 15
Well i know how to remove .php extension but i have a question.
www.example.com/one/two/three
In this type of address, what does "one" and "two" means. Are they folders or just link with out extension.
And how to create like this.
Upvotes: 0
Views: 100
Reputation: 2161
Typically its an MVC route. It means controller/action/param.
You can create it using htaccess by redirecting request to index.php The following will skip existing files from being redirected to the index.php file, and they'll be served normally
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
After that, when request is passed to your index.php file, you can parse $_SERVER['REQUEST_URI']
or $_SERVER['QUERY_STRING']
and load classes that suit your request.
So if, for example, you have request news/read/1, you should find and call class News method read with argument 1.
Upvotes: 1
Reputation: 4620
Try this in your .htaccess file
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L, QSA]
Upvotes: 0
Reputation: 187
Those are can be folders or variables.. using htaccess u can create links like that..
Upvotes: 0