Sagamore .htaccess: Difference between revisions

From Parents
Jump to navigation Jump to search
mNo edit summary
(Explain all the Wordpress URL possibilities)
Line 10: Line 10:
* Search for "<code>site:sagamorehillspta.org</code>" at search engines
* Search for "<code>site:sagamorehillspta.org</code>" at search engines
* See what the [https://web.archive.org Internet Archive] comes up with
* See what the [https://web.archive.org Internet Archive] comes up with

'''Wordpress recognizes quite a few URLs for the same content, because all content under the hood.''' All content can by accessed by its "short link" which uses the post's ID as a query parameter, e.g., <code>/?p=<var>ID</var></code> , which will 301 to the contents cononical address. All Wordpress content are "posts" of various "types", such as posts, pages, attachments, etc. Each post type has its own canonical query parameter—"p" for posts, "page_id" for pages, "attachment_id" for attachements—but ''Wordpress will 301 from any of those to any other, regardelss of post type''.

We will start out defining redirects for the cononical addresses only, but see if we can cover the other possibilities with a blanket redirect.

We shouldn't have to deal with URLs collisions with the new site because we'll be [[Sagamore online goals 2014#URL_redirects|starting with never-used Wordpress post_IDs]].


<pre>
<pre>

Revision as of 14:30, 15 May 2014

To meet Sagamore online goals 2014#URL_redirects, build out a comprehensive .htaccess file on the server that covers the existing Sagamore Hills PTA website (2011-2014) addresses, as well as addresses dropped from the site that still show up via search (but 404) (are there any?).

  • Include all links, even if they forward to the same place another link already does or even if they simply dump to the homepage
  • Inlcude non-page (file) links too (when it makes sense)
  • List addresses in alphabetical order and thoroughly comment to ease future pruning

Discover links by:

  • Browsing site content/file listing (Wordpress admin panel)
  • Search for "site:sagamorehillspta.org" at search engines
  • See what the Internet Archive comes up with

Wordpress recognizes quite a few URLs for the same content, because all content under the hood. All content can by accessed by its "short link" which uses the post's ID as a query parameter, e.g., /?p=ID , which will 301 to the contents cononical address. All Wordpress content are "posts" of various "types", such as posts, pages, attachments, etc. Each post type has its own canonical query parameter—"p" for posts, "page_id" for pages, "attachment_id" for attachements—but Wordpress will 301 from any of those to any other, regardelss of post type.

We will start out defining redirects for the cononical addresses only, but see if we can cover the other possibilities with a blanket redirect.

We shouldn't have to deal with URLs collisions with the new site because we'll be starting with never-used Wordpress post_IDs.

# .htaccess
# Sagamore Hills PTA
# http://www.9.0ne.org/w/Sagamore_.htaccess

# Examples
#
# WITHOUT query parameters
# RedirectMatch 301 ^/openhouse$ http://sagamorehillspta.org/?page_id=975
# WITH query parameters
# Match on query string, match on root (/) (and "?" seems necessary?), append redirect url with "?" to avoid appending the matched query string, redirect permanently
# RewriteCond %{QUERY_STRING} ^page_id=975$
# RewriteRule ^/?$ http://www.sagamorehillspta.org/openhouse? [redirect=301]


# Necessary for "RewriteRule"s
RewriteEngine on