Forum Moderators: phranque
current urls
[mysite.com...]
wish to change it to
[mysite.com...] (title)
Also need to work on duplicate content issue from video showing up in it's own category as well as in most viewed and all videos
Searched multiple times on multiple forums, trying to learn my way around it. Have had good luck with other rewite and redirect .htaccess files, but this one has me stuck.
Any help or direction to forum posts, read most of the standard stuff, just can't get my head around this one.
Thanks in Advance,
Dave
So to map something like:
mysite.com/videos/105/Boating/Hurricane-Ike-Flyover (title)
to:
mysite.com/videos/player.php?vid=105&C=Boating
You may use:
RewriteRule ^videos/([0-9]+)/([0-9a-z]+)/[0-9a-z\-]+$ /videos/player.php?vid=$1&C=$2 [NC,L]
You don't really need the title part tough right?
Mod_Rewrite cannot "change a URL". It connects your URL request (generated from whatever you clicked on) and connects that request to the required internal server filepath.
To get the title into the URL, you need to modify your script so that the script looks at the database and extracts the title and uses that when it is writing out the links on the page.
Mod_Rewrite can then connect that request back to the correct internal filepath. One word of warning: the script will then also need to check that the title requested is correct for that numbered ID, otherwise I could link to you with any words in place of the real title and those alternative URLs would also be indexed and destroy your site with multiple duplicate content issues.
To call a URL-to-filepath translation script using RewriteMap, you must have access to the server config files in order to define that RewriteMap; While RewriteMaps can be used in .htaccess, they must be defined at the server config level (for security reasons). When using a RewriteMap method like this, the server still does most of the content-handling and response code generation.
If you rewrite all appropriate requests directly to a script rather than using RewriteMap, then that script must do all content-handling and provide appropriate and correct server response codes under all conditions. That is, it must translate the requested URL to the appropriate database entry, use that database entry to generate content, and then output all of the server response headers that go with that type of content. If the requested URL does not correspond to a valid database entry, then the script must generate a correct and complete error response.
Jim