Tags:
create new tag
view all tags

Question

Currently, when I enter a url that ends in “/index”, my web browser displays the actual index.html file; it does not redirect users to the home page of our TWiki site. How do I get the redirect string to properly function?

Background: I inserted the following string on line 1 (the very top) of my /twiki/bin/.htaccess file:


   Redirect permanent /index.html http://twiki/bin/view

Issues:

  • First: Is /twiki/bin/.htaccess the proper file in which to place this string?
  • Second: Are each of the three components of my redirect string in its proper form?
    • Redirect permanent
      • What is the difference between using “redirect” and using “redirect permanent”?
    • /index.html:
      • Is it necessary to include the file extension?
      • Do I need to specify any portion of the file path or an http address or is the file name by itself okay? E.g., /twiki/index.html
    • http://twiki/bin/view
      • Our TWiki installation is a “test” system that is accessible only via our intranet. Currently, we’re using the loopback address (127.0.0.1) for the TWiki site. The http address I specified is how our testers and I access the TWiki site here on our intranet. Is there any chance that this is the cause of the problem?
  • Third: Do I need to uncomment and replace !FILE_path_to_TWiki! and !URL_path_to_TWiki! lines in the same .htaccess file? I can’t determine whether this bit of text from the file is instructing me to enter those values in this exact spot or its just describing what you replace each of these with in the sections below it (the authentication and password sections):
    • Note: I uncommented and replaced !FILE_path_to_TWiki! with c:/twiki and uncommented and replaced !URL_path_to_TWiki! with http://twiki/bin/view and then tested it. The result? The TWiki site no longer loads. This doesn’t surprise me as there isn’t any “code” that appears to tell the system how use these values. Thus, I’m guessing that this particular section is just there to tell users what to replace these values with in the sections below it.


# bin/.htaccess.txt
#
# Controls access to TWiki scripts - to make Apache use it, rename this
# file to '.htaccess' and REPLACE THE FOLLOWING STRINGS WITH PATHS
# SPECIFIC TO YOUR INSTALLATION:
#
# !FILE_path_to_TWiki!
#    This is the absolute path to the directory where
#    you installed TWiki (where you unzipped the installation). The first
#    part should match the $dataDir setting in TWiki.cfg
#    Note to DSI users: for our test system, this value is 'c:/twiki'
# !URL_path_to_TWiki!
#    This is the URL path you put into the webserver for users to use to
#    access TWiki.
#

Environment

TWiki version: TWikiRelease04Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows XP Professional Service Pack 1
Web server: Apache 1.3.34 (Win32)
Perl version: 5.8.7-5 (Cygwin)
Client OS: Windows XP Professional Service Pack 2
Web Browser: Internet Explorer 6.0
Categories: Deployment

-- JasonVensel - 02 Mar 2006

Answer

The .htaccess in your twiki/bin is not the right place, it should go in Apache's httpd.conf.

Alernatively, and much more simple, create an /index.html that contains this in the header: <meta http-equiv="refresh" content="0; url=http://www.yourdomain.com/url/path/to/twiki/bin/view">

-- PeterThoeny - 02 Mar 2006

Thanks Peter! I never would have figured that out. I was already aware of the alternative method, but really wanted to use the redirect string. I'm happy to report that I now have it working. Here are some more precise details in case any other newbies like me stumble across this issue.

I inserted the following lines in my c:/Apache/conf/httpd.conf file:


#
# The first path here must be a URL path, not a file pathname
# This first string will redirect URL paths ending in "index"
# to the wiki home page.
Redirect permanent /index.html http://twiki/bin/view
Redirect permanent /index http://twiki/bin/view
Redirect permanent http://twiki http://twiki/bin/view

Notes:

  • TWiki administrators may wish to insert multiple redirect strings because the redirect string only works if the end of the URL path entered by a user matches it exactly. That is, where the redirect string specifies /index, a user who enters a URL that ends in /index.html will NOT be redirected to the home page. That's why I included multiple redirect strings in my file (see above).
  • Multiple redirect strings (as shown above) will work. I tested and verified this.
  • I'm not sure that it matters where in the httpd.conf file you insert the redirect strings (because I haven't tested any other locations), but I inserted mine directly after/below the DirectoryIndex section and directly before/above the AccessFileName section. I can verify that it works when inserted in this location.

-- JasonVensel - 02 Mar 2006

> The .htaccess in your twiki/bin is not the right place, it should go in Apache's httpd.conf.

Or at the top level (the twiki directory, above bin).

(As I discovered today, some hosting sites don't allow access to httpd.conf. TWiki is under ~!public_html. Shudder

-- Vicki Brown - 2014-03-06

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2014-03-06 - VickiBrown
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.