WordPress.org

Ready to get started?Download WordPress

Forums

permalinks: a moment of clarity (7 posts)

  1. dss
    Member
    Posted 9 years ago #

    If you are a permalink pro, then you may wanna pass over this post.
    I have been frustrated with almost all of my (non kubrick) installations of WP because the entries and archives come up with lame link addresses.
    for a long time i've lurked here and read about "permalinks"
    i've always thought "wouldn't it just be killer if all the entries could come up simple and clean like "http://mydomain/the-tite-of-todays-entry" ?
    so i stumbled about and timidly tried to change the permalinks and got a lot of "not found" errors, but never investigated. I set it on the back burner and said "maybe someday someone will explain how this works well enough for me to really try it."
    well that's today, and i'm gonna explain it:
    If you want to alter the way your links come up for simplicity, the love of a good URI (or URL) or you just forget all those numbers and junk so you tell people to use the archives page, or rifle through your categories... but they don't, do they?
    here's how you make your links fabulous "permalinks"
    in /wp-admin/options there is a link called "permalinks"
    click it, and you are here: /wp-admin/options-general.php
    All the junk you see on this page (that your eyes scan over without registering) are the thoughtful tags you can use to create "permalinks," meaning you have choices about how you want your links to look.
    here's what i did:
    i copied this from the options page:
    /index.php/archives/%year%/%monthnum%/%day%/%postname%/
    and i pasted it into the first box and clicked the button called "update permalink structure"
    then i went to my index, and i clicked on a title...
    what do you know? no more "index.php?xyz...blah...33" it said:
    http://mydomain/index.php/archives/year/month/day/title
    i saw the light...
    not wanting links that long, i removed everything that seemed silly to me, leaving:
    /%postname%/
    i clicked the "update" button, and went back to the index to click on a title...
    oh no! not found...
    crud...
    Then i noticed that there was this creepy little text generated in the last box, i felt sure it wasn't there before. i read it, and it said:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?category_name=$1&feed=$2 [QSA]
    RewriteRule ^category/?(.*) /index.php?category_name=$1 [QSA]
    RewriteRule ^author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?author_name=$1&feed=$2 [QSA]
    RewriteRule ^author/?(.*) /index.php?author_name=$1 [QSA]
    RewriteRule ^([_0-9a-z-]+)/?([0-9]+)?/?$ /index.php?name=$1&page=$2 [QSA]
    RewriteRule ^([_0-9a-z-]+)/?/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?name=$1&feed=$2 [QSA]
    RewriteRule ^([_0-9a-z-]+)/?/trackback/?$ /wp-trackback.php?name=$1 [QSA]
    RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1 [QSA]
    RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1&withcomments=1 [QSA]

    then i read what to do with it...
    it is right there on the page (who knew?)
    so i created a simple text file, and copied this text into it.
    then i named it "htaccess" leaving the "." off the start of it on purpose.
    i uploaded it to my root folder (making sure there wasn't already a file called ".htaccess" there (which there wasn't)
    then i renamed the file ".htaccess"
    returning to my index, all my links, no matter where i went were simply:
    "http://mydomain/title-of-my-entry"
    impressed. thrilled. excited.
    i ran right here to tell you all about it.
    *one note worth mentioning:
    if you do already have a file in your wp installation's root folder, then you just have to download it, open it up, and add that arcane text to it, save it and reload it.
    WP keeps blowing my mind.
    i really hope this helped someone.
    f.

  2. Sorry you had to find that out so late after putting up with the standard permalink structure. Better late than never! =)
    - Bryan

  3. borstahusen
    Member
    Posted 9 years ago #

    http://localhost/wordpress/index.php/archives/category/general/
    gives "No input file specified."...
    Then, it may not work having wordpress in its own folder??
    Sorry for leaving two messages.
    Cheers

  4. clay
    Member
    Posted 9 years ago #

    One thing to note is that your chosen schema for permalinks has a strong possiblity of not resulting in a unique link.
    As time goes by it might become frustrating to need unique post titles for every single entry ever made.
    I would suggest adding something like the date to your permalinks schema
    ie
    /%day%/%postname%/

  5. dss
    Member
    Posted 9 years ago #

    interesting,
    i hadn't thought about that.
    i suppose it's possible that i would duplicate the title, but, for me, unlikely.
    however it is a good notion for others.
    borstahusen:
    can you explain how you arrived at this error?
    what were your permalink selection?
    how did you handle the htaccess that output from the permalinks page?
    maybe i can help.
    (see one, do one, teach one)

  6. borstahusen
    Member
    Posted 9 years ago #

    clay: I really hope not to repeat myself to much :-)
    dss: I just found that httpd.conf for the WP directory has to read:
    AllowOverride FileInfo (or All - NOT None)
    Thus:
    <Directory "/.../web_root/wp">
    AllowOverride FileInfo
    </Directory>

    I loaded the mod_rewrite, and changed the .htaccess accordingly, but had one of two experiences:
    Either I put in "index.php", and got "No input file specified."
    Or, I didn't, and got 404.
    Thank you for your interest!

  7. dss
    Member
    Posted 9 years ago #

    interesting...
    i made no such <directory "... addition. Unless you mean to allow sub folder htaccess. maybe the concept is over my head (wouldn't surprise me.)
    only thing i did learn further today about the "no such file" and "404" errors was that for whatever reason, when i shortened my threads to just URL/Title some images, and other static content was not found and either returned with errors, or broken images/links.
    i went back over the index.php file, and i discoverd the url (./blah) method of linking didn't work beyond the index page. so i changed them all to express the entire URL. And everything is just fine now.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.