PHPmotion Add-on: Channels URL rewrite


This is a slightly easier modification as to the previous one for the member’s profiles. As it only requires modifying one file, since the category_home.php already uses the category name you’ll only have to edit the .htaccess file

This mod will simply allow you to have enter urls like:

example.com/channels/comedy

instead of

example.com/category_home.php?cid=comedy

Which ones easier to remember?



If you’ve already done the member profile mod then all you will have to add is in the .htaccess file:

RewriteRule ^channel/(.*)$ /category_home.php?cid=$1 [L]

Under this:

RewriteRule ^user/(.*)$ /memberprofile.php?user=$1 [L]

Easy huh?

If you haven’t done this mod:

If you haven’t done this mod it’s not much harder simply create your .htaccess file (in the root folder) if it doesn’t already exist and add this:


RewriteEngine On
<ifmodule>
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^user/(.*)$ /memberprofile.php?user=$1 [L]
RewriteRule ^channel/(.*)$ /category_home.php?cid=$1 [L]
</ifmodule>

Upload and your done! However this doesn’t yet support pages, this doesn’t mean it doesn’t work, simply that once you’ve clicked page 2, etc… the url will revert to the original e.g.:

example.com /category_home.php?page=2&cid=Test%20Vids

PS: As with the other mod rewrite you must edit all links, imgs, scripts… This is a pain but it’s easier in the long run! Either add a / like so:

<a href =”/index.php”>Videos</a>

Or the complete url:

<a href=”[var.base_url]/index.php”>Videos</a>

The last one is preferable.
That’s not too bad now is it?

Don’t fancy getting your hands dirty? Let me set it up for you for 5€ (within 48hrs)

2 Responses to “PHPmotion Add-on: Channels URL rewrite”


  1. 1 sabrina

    which pages/templates are we supposed to edit the links, imgs scripts? it doesnt specify up top

    thanks

  2. 2 Ben

    If you download the template files I’ve just released you don’t to edit any at all ;) but then you may be using zer0ones templates…

    The best would be to edit all links, images, etc…

Leave a Reply