Similar to WordPress permalinks. Does anybody know how to make a .htaccess file that imitates an url.
An example is a site I am building. Pages are selected by going to http://www.doamin.com/d/?p=about
I know this can be done, but have absolutely no idea how to combine .htaccess with php.
I have googled to no avail. I can’t think of any good keywords to use, nothing to describe the issue here.
Sorry, I forgot to include the link. :oops:
It is a confusing subject because it involves two of the great mysteries of the intarwebz. Apache .htaccess files and regular expressions.
Apostrophe posted a good link about .htaccess so I will post one about regular expressions in general – http://www.regular-expressions.info/
I recommend anyone that wants to achieve clean urls and is starting a site from scratch should look at using a MVC/MTV framework
CodeIgniter, cakePHP, Zend Framework ect…
Keep in-mind the way they handle the rewrite rule breaks the way most people are accustomed to building web sites….
Traditionally sites follow a folder structure
The Rewrite will instead of looking in that folder for that file it treats everything a variable
Rewrites to http://example.com/index.php
Then index.php takes "home/index" as a variable and delivers content accordingly
(Controller = ‘home’, Action = ‘index’)
In addition, this will allow you to define custom uri structures like
This will point to the profile controller and give a username variable equal to benjamin allowing you to pull up content about a unique person
Anyways, take a look at it, alot of sites use frameworks like such and for good reason too, very powerful, extensive useful libs and faster development of your sites
I’m currently learning CodeIgniter and am having problems with the .htaccess regex part.
From their wiki, I’m using the following RewriteRule:
Yet it does not work.
You must be logged in to reply to this topic.