Grow your CSS skills. Land your dream job.

WordPress URLs

  • # February 4, 2013 at 3:17 am

    I am working on a CMS of my own at

    I would like to make wordpress like URLs for it and i know the htaccsess part but im wondering how the PHP works.

    Could you maybe give me some starting code and ill try to do the rest.

    # February 4, 2013 at 9:53 am

    @htmlmainiac You should never give out your login credentials. Especially in a community forum.

    What exactly are you trying to do? I’m not fully understanding.

    # February 4, 2013 at 11:40 am


    > You should never give out your login credentials. Especially in a community forum.

    Sory about that but you need them to view it and that is the only thing in that folder.

    I’m trying to make WordPress like petty permalinks.

    # February 4, 2013 at 11:53 am

    You’ll need to set up some mod-rewrite rules in your .htaccess file.

    # February 4, 2013 at 11:56 am

    I did say i know how to do that.

    What i am asking for is the PHP side of it

    # February 4, 2013 at 12:00 pm

    @htmlmainiac You have to set the filename to match what you want (e.g. some-random-name.php) and then remove the .php extension. At least that’s one way of doing it.

    If you’re already using WordPress, why not build a page with that?

    # February 4, 2013 at 12:13 pm

    @chrisburton It’s for my own CMS I’m working on.

    # February 4, 2013 at 5:02 pm

    I still don’t have what I was asking for

    # February 4, 2013 at 5:22 pm

    @htmlmainiac Yeah, it’s best to have a little patience in the forum.

    “I want WordPress (pretty) URL’s” is not really anything to go on. We don’t know how your site’s URL’s are structured since you don’t really have any pages up except “Home” and “About”. If that is the way it will be, removing the .php extension is what I suggested above.

    # February 4, 2013 at 5:25 pm

    @chrisburton It works but what about the query strings that’s what I want it to do too.

    # February 4, 2013 at 6:02 pm

    htaccess isn’t my area so I don’t think I can help you any further. Sorry.

    # February 4, 2013 at 6:05 pm

    This is all about php now not htaccess

    # February 4, 2013 at 6:08 pm

    There are lots of ways of achieving what you want to achieve. The first is to use .htaccess to rewrite everything to index.php (except the files you want a user to access directly). You can then use something like:


    To determine their perceived URI and act upon it (remember to preserve GET request parameters).

    An alternative method, if you have a consistent and predictable structure, is to act on the URL in .htaccess to turn the URI into GET parameters. For example, Zend URLs have a very strict format:


    This means .htaccess can (if you want) split those components and formulate a GET request, rewriting (again) to index.php.

    However, creating a CMS is a big task. I assume you are using it as a learning experience. Unless you specifically want to learn how to construct these sorts of module, I would focus on more fundamental components first. Ugly URLs don’t make your system unusable and are best addressed at or near the end, once you know the sort of information your URLs will contain.

    # February 4, 2013 at 6:15 pm

    Sorry — you posted while I replied.

    > This is all about php now not htaccess

    You don’t seem to realise how these are connected. As I allude to above, parts of this process can be done by either. It is down to you as to which you want to use.

    Personally I favour .htaccess doing a minimal amount of work, as I think it is easier to preserve backwards compatability that way. However, if you take a look at (look at both his php and .htaccess source) you will see that he uses .htaccess heavily in his rewrites.

    Compare Kroc’s .htaccess file with that of Kirby, for example:

    If you ignore the comments, it’s only 13 lines (2 of which can be omitted on many servers because he’s covering himself in case mod_rewrite isn’t available).

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".