1 / 28

Understanding and Creating Aliases

Understanding and Creating Aliases. October 27, 2010. Agenda. Aliases Redirects Resources. 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

Télécharger la présentation

Understanding and Creating Aliases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Understanding and Creating Aliases October 27, 2010

  2. Agenda • Aliases • Redirects • Resources

  3. 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

  4. Aliases • Common uses: • Create user-friendly URLs • Change URL for content • Types used at EPA: • Symbolic Links • DNS Aliases

  5. 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

  6. 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/

  7. Visit www.epa.gov/webguide • Select “Create or Remove Alias” under “Create a Web Area” • http://intranet.epa.gov/webmast3/webguide/aliasform.html Requesting an Alias

  8. 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

  9. 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:Westfield.Tracey@epa.gov 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.

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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)

  18. .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

  19. 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.html)

  20. .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

  21. 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

  22. 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

  23. 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

  24. 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/

  25. 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

  26. .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

  27. 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

  28. Resources • Web Guide: Customize A Web Areahttp://yosemite.epa.gov/oei/webguide.nsf/customize • Web Guide: Create or Remove an Aliashttp://yosemite.epa.gov/OEI/webguide.nsf/create/alias • 2007 Web Workgroup Presentation on .htaccess fileshttp://intranet.epa.gov/webgroup/meetings/03-07/agenda.html • Apache Tutorial on .htaccess files http://httpd.apache.org/docs/2.0/howto/htaccess.html

More Related