Forum Moderators: phranque

Message Too Old, No Replies

Possible redirection required?

         

stretchwickster

12:57 pm on May 3, 2007 (gmt 0)

10+ Year Member



Hi there,

I create demo movies in Adobe Captivate and publish them online to be accessed via html pages with the following file naming convention: "Ref1234_v123.htm"

I have created a button in one movie which links to another movie in the same directory. However, on clicking this button, it tries to open "ref1234_v123.htm" (which doesn't exist due to case sensitivity) even though I've entered "Ref1234_v123.htm" as the target movie filename.

I have loads of these movies (adopting the same file naming convention), so is there some way I could redirect all requests for a file of the format "ref1234_v123.htm" to "Ref1234_v123.htm"? What would be the most appropriate way of achieving this? I have been warned by my web host that mod_rewrite might be of use but can cause more headaches than solutions!

Your advice/view on this would be much appreciated.

jdMorgan

1:38 pm on May 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hosts fear mod_rewrite because it is a powerful tool. And like the users of other powerful tools, some of their users cut their fingers off because they did not read the manual [httpd.apache.org] and follow the safety advice. This raises the hosts' customer support costs, so they often protray it as dangerous black magic.

In fact, this application does not require mod_rewrite, unless you want to use an internal rewrite rather than an external redirect. You can use the mod_alias RedirecMatch directive [httpd.apache.org] for a simple redirect.

In fact, it might be simpler to just rename your movie files to lowercase; If you do that, then no mod_rewrite or mod_alias directives will be needed at all.

But here's an example of mod_alias code:


RedirectMatch 301 ^/path_to_movie_dir/ref([0-9]+)_v([0-9]+)\.htm$ http://www.example.com/path_to_movie_dir/Ref$1_v$2.htm

If you put the code into www.example.com/.htaccess, you will need to insert the movie directory path into both 'sides' of this directive, as shown. If you put the code into www.example.com/path_to_movie_dir/.htaccess, then you'll only need to include the path on the 'right side'.

Jim

stretchwickster

2:25 pm on May 3, 2007 (gmt 0)

10+ Year Member



Many thanks for the comprehensive explanation Jim.

I used RedirectMatch (mod_alias) and it's now working perfectly.

I had considered renaming my movie files to lowercase. However, they are packaged up with a locally-installed software product, as well as being available online. Consequently, to change all the references online and in the local software product would cause more problems than it's worth.

The mod_alias technique works beautifully so many thanks for that and particularly for the very apt example.