+ All Categories
Home > Documents > Office of Technology Operations & Planning Understanding and Creating Aliases October 27, 2010.

Office of Technology Operations & Planning Understanding and Creating Aliases October 27, 2010.

Date post: 24-Dec-2015
Category:
Upload: lee-gaines
View: 215 times
Download: 0 times
Share this document with a friend
Popular Tags:
28
Office of Technology Operations & Planni Understanding and Creating Aliases October 27, 2010
Transcript

Office of Technology Operations & Planning

Understanding and Creating AliasesOctober 27, 2010

Office of Technology Operations & Planning

Agenda

• Aliases

• Redirects

• Resources

Office of Technology Operations & Planning

Aliases vs. Redirects

• Alias

– False name to conceal one’s identity; Assumed name

– Used to make a web page or directory on the same

server available under many URLs

• Redirect

– To change the direction or course of

– Used to make a web page or directory on the same

or different server available under many URLs

Office of Technology Operations & Planning

Aliases

• Common uses:

– Create user-friendly URLs

– Change URL for content

• Types used at EPA:

– Symbolic Links

– DNS Aliases

Office of Technology Operations & Planning

Symbolic Links

• A text string that is interpreted by the operating

system as a path to another file or directory

• Used on the static web Linux servers:

www.epa.gov, intranet.epa.gov, staging.epa.gov

• Also used on other Linux servers (e.g., OAS)

• All TSSMS accounts are a symbolic link

– Data resides at /public/data/TSSMS/web

– Symlink resolves to /TSSMS/ so that the URL

www.epa.gov/TSSMS/ will render the content

Office of Technology Operations & Planning

Symbolic Links

• Since TSSMS accounts are 8-characters, need an alias to

obtain a user-friendly URL

• NCC Sys Admins place the symbolic link in the htdocs file

• Example:

– Content resides at www.epa.gov/opp00001/bedbugs/

– Request symbolic link (alias) to obtain URL:

www.epa.gov/bedbugs/

Office of Technology Operations & Planning

Requesting an Alias

• Visit www.epa.gov/webguide

• Select “Create or Remove Alias” under “Create a Web

Area”

• http://intranet.epa.gov/webmast3/webguide/aliasform.html

Office of Technology Operations & Planning

Fulfilling the Request

• Request goes to technical contracting team, OEAEE

(formerly known and OPA) and OEI

• OEAEE and OEI have 24 hours to reject or ask

questions about the request

• If no objections are expressed within 24 hours,

support contractor will create the alias

Office of Technology Operations & Planning

Alias Instructions

Individual Filing the Request: Tracey Westfield

EPA Federal Account Manager Name: Tracey Westfield

EPA Federal Account Manager Phone Number: 202-564-5586

EPA Federal Account Manager Email: [email protected]

EPA Server: public

TSSMS Account Name: lawsregs/regstat/

Alias to be added or removed: http://www.epa.gov/regstat/

Action: create alias

Additional Alias Names:

Additional Notes: This is a request for an alias on a folder within the LAWSREGS TSSMS. The folder name is "regstat". That folder currently has one "placeholder" index page, but it'll be populated with a lot more files soon. The new Reg Stat website is under development and currently on a staging server, but I want to have the alias ready once we migrate the files to the "regstat" folder.

Office of Technology Operations & Planning

Managing Aliases

• Linux is case-sensitive

• Aliases will be granted for lowercase letters only

• If you have more than one alias for your site, must identify a

primary alias: http://www.epa.gov/cgi-bin/SPA/selectalias

• Consider removing all aliases other than the primary alias

(critical for consistent linking and WebCMS publication)

• If the target site for your alias is moved or deleted, remember to

update or remove your alias (use the Alias request form in the

Web Guide)

• OEI periodically reviews orphaned aliases and deletes them

Office of Technology Operations & Planning

Impact on Search / Stats

• Some search engines do not recognize symlinks as the

same file (e.g., Northern Light) – they will display each

alias as a new site

• Google search should reconcile aliases and display only

one page (not 100% sure, though)

• Analog statistics for each alias is collected separately

www.epa.gov/water, www.epa.gov/ow,

www.epa.gov/OW

• Maxamine tries to aggregate statistics for multiple

aliases, but does not always know when a new alias is

created or one removed

Office of Technology Operations & Planning

DNS Aliases

• Resource record in the Domain Name System

(DNS) that specifies that the domain name is an

alias for another domain

• Used to create URLs for dedicated servers

• Can have more than one DNS entry per server

• Obtained during the ADC process

Office of Technology Operations & Planning

DNS Alias

Example

• IP address: 123.45.6.78

• Server name: kestrel.rtpnc.epa.gov

• DNS alias entries:

– intrawiki.epa.gov

– intrablog.epa.gov

– nationaldialogue.epa.gov

Office of Technology Operations & Planning

Redirects

• Common Uses of Redirects– Redirect users away from a discontinued server

– Load balancing

– Display error pages for removed sites

– Ensure old links still work when pages are moved or renamed

– Allow users to use an abbreviated or more memorable URL

• Types of Redirects Used at EPA:– Client-side redirects using redirect code

– Server-side redirects using .htaccess file

– NOTE: We don’t use the rewrite rule in the Apache config file

Office of Technology Operations & Planning

Client-Side Redirects

• Used to redirect users from one server to an application or

Website on another server

• Use the web browser to redirect users to the new URL

• Redirect code is read in the metadata tag field

• Created and managed by the content owner

• Directions and sample redirect code:

http://yosemite.epa.gov/OEI/webguide.nsf/create/alias#dynamic

• All bookmarks to the content will be displayed as the destination

URL not the requested URL

Office of Technology Operations & Planning

Client-Side Redirects• Steps in creating a redirect for your site or application:

– Create a new TSSMS account or a directory under an existing TSSMS account

– Request an alias for that TSSMS account or directory

– Place redirect code inside the new TSSMS account or directory

• Example:

– Create new TSSMS account “MYAPPLIC” (www.epa.gov/myapplic)

– Request alias “www.epa.gov/myapplication” to go to (www.epa.gov/myapplic)

– Write redirect code for www.epa.gov/myapplic to go to

http://cfpub.epa.gov/myapplication

• Effect:

– User enters http://www.epa.gov/myapplication

– Browser reads www.epa.gov/myapplication and sends user to

www.epa.gov/myapplic

– Host location redirects user to http://cfpub.epa.gov/myapplication

Office of Technology Operations & Planning

Client-Side Redirect Code

• An example of a redirect page is epa.gov/npdes/, which

uses an HTML redirect to send readers to

cfpub.epa.gov/npdes/ as follows:<HTML>

<HEAD>

<meta http-equiv="refresh" content="0" URL=http://cfpub.epa.gov/npdes/">

</HEAD>

</HTML>

• This particular code does not incorporate a delay

• To incorporate a delay, change the value of the content tag

(For example, content="3" would provide a three second

delay, which would allow you to display a transfer

message)

Office of Technology Operations & Planning

.htaccess Redirect

• Used to redirect users from a URL to a page or directory on either

the same or different server

• Place configuration directives in a text file called .htaccess

• Place the .htaccess file in the directory to be configured

• If the configuration is to be applied to the entire site, place

the .htaccess file in the root directory of your site

(/public/data/TSSMS/web)

• The directives will be applied to the directory with the .htaccess file

and all subdirectories thereof

Office of Technology Operations & Planning

Other Uses of .htaccess

• Custom 404 Pages

• Password-Protected Directories

• IP-Protected Directories

• For more information, see Leann Spradling’s “Using Apache

.htaccess Files” presentation from the March 2007 Web

Workgroup Meeting (Potomac Yard) (

http://intranet.epa.gov/webgroup/meetings/03-07/agenda.h

tml

)

Office of Technology Operations & Planning

.htaccess Redirection

• Place an .htaccess file in your root directory with this

directive in the file:

Redirect Code /path URL

• The “code” is optional

• Possible codes include:

– 301: Moved Permanently

– 302: Temporarily Moved (default)

– 303: Other

Office of Technology Operations & Planning

Example

Create a redirect to files on a different server:

Redirect /sample01/old.html

http://yosemite.epa.gov/sample01/new.html

• Place .htaccess file under: /public/data/sample01/web/

• Redirects any user who requests

www.epa.gov/sample01/old.html to

yosemite.epa.gov/sample01/new.html

Office of Technology Operations & Planning

Example

Create a redirect to files on the same server:

Redirect /sample01/old.html

http://www.epa.gov/sample01/new.html

• Place .htaccess file under: /public/data/sample01/web

• Redirects any user who requests

www.epa.gov/sample01/old.html to

www.epa.gov/sample01/new.html

Office of Technology Operations & Planning

Example

Use a site alias (symlink) in the redirect

– “sample” is an alias to “/public/data/sample01”

Redirect /sample/old.html

http://www.epa.gov/sample/new.html

• Place the .htaccess file in the /public/data/sample01/web

• Redirects any user who requests

www.epa.gov/sample01/old.html to

www.epa.gov/sample01/new.html

Office of Technology Operations & Planning

Redirect Match

• Allows you to redirect multiple files with regular

expressions

redirectmatch /air(.*) /reg5oair$1

• Tells the server "if the request is /air, followed by anything

else, remember the anything else. Then go to reg50air,

and put the anything else after that.

• This expression would redirect users who enter

http://www.epa.gov/region5/air/glakes/ to content located

at http://www.epa.gov/reg5oair/glakes/

Office of Technology Operations & Planning

Stacking Directives

• There can only be one .htaccess file per

directory

• All directives for the directory must be in that

one file, including:

– Redirection

– Password Protection

– 404 Error

– IP Protection

Office of Technology Operations & Planning

.htaccess Problems

• Precedence

– Applied in the order they are found by the web server

– If there is a conflict, the .htaccess file in the subdirectory will

take precedence when a file is requested from that

subdirectory

• Syntax Errors

– Instructions depend on correct syntax

– Might not render content if syntax error (HTTP 500 error)

• Webserver Load

– If there is an .htaccess file in a directory, Apache must check

all the directories above it for other .htaccess files that may

apply

Office of Technology Operations & Planning

Avoiding Problems

• Test in staging and again when go to production

• Ensure .htaccess files are world-readable

• Use the webguide documentation

• Consider if an .htaccess file is truly the best solution

– Consider using an HTML redirect page instead

• Minimize the number of .htaccess files in a site

• Minimize the number of directives used

• Maintain .htaccess files – remove outdated directives

• Comment your .htaccess files for future reference

• Keep track of existing .htaccess files to avoid conflicts

Office of Technology Operations & Planning

Resources

• Web Guide: Customize A Web Area

http://yosemite.epa.gov/oei/webguide.nsf/customize

• Web Guide: Create or Remove an Alias

http://yosemite.epa.gov/OEI/webguide.nsf/create/alias

• 2007 Web Workgroup Presentation on .htaccess files

http://intranet.epa.gov/webgroup/meetings/03-07/agenda.h

tml

• Apache Tutorial on .htaccess files

http://httpd.apache.org/docs/2.0/howto/htaccess.html


Recommended