I want to make two short by options for the users to be able to check out the most recent uploads and the ones with the most views. The query works fine but i dont know how to make the link (<a href="") work.
I made this change on the .htaccess file

RewriteRule ^audios&([0-9]+)$ audios.php?recent=true
RewriteRule ^audios&([0-9]+)/$ audios.php?recent=true

the variable $base_url works fine

Here is the code:

<a href="'.$base_url.'audios&recent=true">Most Recent</a>
<a href="'.$base_url.'audios&most=true">Most Viewed</a>

                            if (isset($_GET['recent']) && ($_GET['recent'] == 'true'))
                                $Order = " ORDER BY M.created DESC";
                            else if (isset($_GET['most']) && ($_GET['most'] == 'true'))
                                $Order = " ORDER BY M.views_count DESC";

the .php file is called audios.php

3 Years
Discussion Span
Last Post by iamthwee

I'm not sure I understand. Just simply create a link 'most recent' but call a different sql query, I don't understand the need for a htaccess file can you explain?


i thought that it will be a good idea to loose the .php extension and simply create the link. I guess thats wrong. How will the link be?


If you want to loose the php extension I think it should be site wide, and not just for one thing. If you pick a good php framework most have site friendly urls.


Not really, choosing a PHP framework is up to you and will require a learning curve. I would say codeigniter but I'm biased to say that having used it now for a few months. Laravel might be a better option.

Otherwise you'll have to write your own rewrite rules for you web app. It is fraught with pitfalls.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.