Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess url rewrite querystring
    primarykey
    data
    text
    <p>Ok I've read and search some here but haven't found an answer for my question or maybe im too new to url rewrite and just can't figure it out. Here's what I am trying to accomplish:</p> <p>I have a table that holds channels description and ID, the ID is used to know what content to show, so I have something like this in my URL</p> <pre><code>http://www.mysite.com/page?channel=1 </code></pre> <p>now what I would like to do is to display this:</p> <pre><code>http://www.mysite.com/page/description </code></pre> <p>and still be able to somehow get the id of that description to display the appropriate content. hopefully this makes sense. The only thing that i've thought of is at the top of my page, do a:</p> <pre><code>select * from channels where description = $_GET['description'] </code></pre> <p>and have that return the id, and then use it. Would that be the only way to go? or is .htaccess good enough? such a noob :(</p> <p>EDIT: this is in my htaccess right now:</p> <pre><code>AddType x-mapp-php5 .php Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / ## hide .php extension # To externally redirect /dir/foo.php to /dir/foo RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R,L,NC] ## To internally redirect /dir/foo to /dir/foo.php RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^ %{REQUEST_URI}.php [L] ##This is to redirect just stream page only RewriteRule ^stream/(.+)/([0-9]+)$ /stream.php?channel=$1 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload