Forum Moderators: phranque
i'm creating a site that is for videos. every time i have new videos, it generates a unique video key and that is the url that the video will use or its actual address. i need help how to rename its url to its filename of the video. i guess .htaccess and mod write will do that but i'm a newbie on that process. any help?
sample: http://www.example.com/myfolder/myvideo/view_video.php?viewkey=ebd93369ce542e8f2322&page=1&viewtype=&category=mr
i want to change this to
http://www.example.com/myfolder/myvideo/name-of-the-video-that-is-playing
and based on some threads here. i used .htacces to that code:
RewriteEngine On
Rewritecond %{REQUEST_FILENAME}!-d
RewriteRule ^([-,_0-9a-zA-Z]+)/?$ view_video.php?viewkey=$3 [L]
correct me if i am wrong... Thanks guys.
[edited by: jdMorgan at 2:43 am (utc) on Dec. 4, 2007]
[edit reason] example.com [/edit]
$1;
[-,_0-9a-zA-Z]regular expression is quite complicated compared to what you need, I'd suggest to make it only
[0-9a-z]and make the RewriteRule case insensitive (NC modifier);
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^([0-9a-z]+)/?$ view_video.php?viewkey=$1 [NC,L]
Did you checked that the use of the .htaccess files are enabled after all? For more infromation on the .htaccess file and the mod_rewrite see Apache Tutorial: .htaccess files [httpd.apache.org] and URL Rewriting Guide [httpd.apache.org].