Archive for the ‘webserver’ Category

Techie Tip of the Week: Installing Drupal or WordPress Themes on Stanford’s Web Servers

Friday, April 5th, 2013

If you’re using the Collaboration Tools Installer or manually installing a Drupal or WordPress site on Stanford’s AFS servers, you may have wondered how you can update existing or install new themes, since you can’t do so directly within the application.

Here’s how:

1) Download the theme to your Desktop.

2) Unzip the theme.

3) Open an SFTP program like SecureFX or Fetch, log in, and change the plugin directory for your Drupal or WP instance:

For Drupal:
The directory should be something like “/afs/ir/group/groupname/cgi-bin/drupaldirectory/sites/all/themes”  (substitute groupname for your real group name; drupaldirectory for your real Drupal directory name)

For WordPress:
The directory should be something like “/afs/ir/group/groupname/cgi-bin/wordpressdirectory/wp-content/themes” (substitute groupname for your real group name; wordpressdirectory for your real WP directory name)

4)  Activate/Enable the theme:

  • For Drupal:
    Launch a web browser and log into your Drupal site.
    Go to administer > site building > themes and then check the Enabled box next to the desired theme.
  • For WordPress:
    Launch a web browser and log into your WordPress site.
    Go to Appearance > Themes and then click Activate underneath to the desired theme.

Your new theme is now active on your site!

Techie Tip of the Week: Installing WordPress Plugins on Stanford’s Web Servers

Friday, March 15th, 2013

Because the Stanford web servers require encryption using SFTP, and WordPress’s built-in method of installing and implementing a plug-in uses FTPS, you cannot install plugins from directly within WordPress.

Instead, you need to manually install the plugin.

Here’s what you need to do:

1) Download the plugin to your Desktop.

2) Unzip the plugin.

3) Open an SFTP program like SecureFX or Fetch, log in, and change the plugin directory for your WP instance:

The directory should be something like “/afs/ir/group/groupname/cgi-bin/wordpressdirectory/wp-content/plugins” (substitute groupname for your real group name; wordpressdirectory for your real WP directory name)

4) Drag the plugin folder from your Desktop to the Remote Site side of SecureFX/Fetch.

5) In WordPress, go to your Dashboard (http://www.stanford.edu/group/groupname/cgi-bin/wordpressdirectory/wp-admin)

6) Click Plugins.

7) Locate the installed plugin and click Activate.

Your plugin is now activated!

Techie Tip of the Week: Redirect Web Pages to New Locations – permanent redirect method

Friday, March 2nd, 2012

Last week, we talked about using the META REFRESH method to redirect visitors to your web pages to new locations. This week, we’ll show how you can manipulate the web server to permanently redirect visitors to the new location even before the old web page opens.

Permanent Redirect Option

To permanently redirect visitors to new locations:

  1. Create a text file with the filename .htaccess
  2. In this .htaccess file, enter the following, substituting oldlocation with the relative reference to the redirected page (relative to the root level of the web server) and newlocation with the fully-qualified (complete, full address) URL of the new location:

    redirect 301 oldlocation newlocation

    So, for example, if the old location was http://www.stanford.edu/group/widgets, and the new location is http://www.stanford.edu/dept/cgi-bin/widgetdepartment, the .htaccess file should read:

    redirect 301 /group/widgets http://www.stanford.edu/dept/cgi-bin/widgetdepartment

  3. Save.
  4. Upload the .htaccess file to the appropriate directory on your web server.

Another way to implement a 301 (permanent) redirect:

Upload a .htaccess file in the directory you wish to redirect from with the following:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) newlocation$1 [R=301,L]

So, in our example:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)
http://www.stanford.edu/dept/cgi-bin/widgetdepartment/$1 [R=301,L]

Techie Tip of the Week: Redirect Web Pages to New Locations (meta refresh method)

Friday, February 24th, 2012

Has your group redesigned your website and moved to a new location? Renamed your organization’s name? Want to automatically redirect visitors to your web site to the new location? This week and next week’s tips will show you how.

There are basically two options to redirect visitors to your web site to a new location: the meta refresh method and the permanent redirect method. This week, we’ll show the META REFRESH method.

Redirecting using META REFRESH

NOTE: This method works best if you are only redirecting a single page to a new location.

  1. Open the source code of the web page you wish to redirect in a text editor.
  2. In the HEAD section, enter the following code (substitute num with the desired number of seconds the browser will wait before redirecting; substitute newlocation with the new URL.

    <meta http-equiv="refresh" content="num; url=newlocation" />

    So, for example, to redirect to stanford.edu after 3 seconds:

    <meta http-equiv="refresh" content="3; url=http://stanford.edu" />

You can also use the META REFRESH method without the URL to have a web page automatically reload after a certain number of seconds. Newspaper and other news-oriented web sites often do this.

For example, to automatically reload the browser every 30 minutes (1800 seconds):

<meta http-equiv="refresh" content="1800" />


Next week, we will talk about Option 2: permanent redirects!

Techie Tip of the Week: Restrict Access to Web Content

Friday, February 10th, 2012

Want to put a document on the Web but don’t want just anybody to be able to access it? Need to restrict access to a section of your website? This week’s Techie Tip of the Week will show Stanford affiliates can restrict access to their web content by requiring potential viewers to sign in with their SUNet ID using WebAuth.

To restrict access to sensitive document (e.g., a Word, Excel, PowerPoint, or web page document), the simplest method is to create a web directory, restrict access to that directory, and then place documents into this directory for protection.

  1. Create the web directory to be protected.
  2. Create a text file called “.htaccess” using a text editor.
  3. In the .htaccess file:
    • To restrict access to anyone with a valid SUNet ID:
      AuthType WebAuth
      require valid-user
    • To restrict access to specific SUNet IDs (in this case, only jdoe and jsmith can access the content):
      AuthType WebAuth
      require user jdoe jsmith
    • To restrict access to certain a pre-defined privileged group:
      AuthType WebAuth
      require privgroup groupname

      • There are 6 privgroup names you can currently use:
        • Current faculty: stanford:faculty
        • Current staff members: stanford:staff
        • Current students (graduate and undergraduate): stanford:student
        • All faculty, staff and sponsored affiliates: stanford:administrative
          • For example, to restrict access to just current faculty, staff, and students:
            AuthType WebAuth
            require privgroup stanford:stanford
      • To allow access to a group of SUNet IDs (defined in the Workgroup Manager, http://workgroup.stanford.edu):
        AuthType WebAuth
        require privgroup groupname

        • For example, if your group name is officemates, and your SUNet ID is jdoe, the .htaccess file will have the following code:
          AuthType WebAuth
          require privgroup ~jdoe:officemates

For more information, visit:
https://itservices.stanford.edu/service/web/centralhosting/webauth/directives