WordPress.org

Ready to get started?Download WordPress

Forums

Help with location of posts. (8 posts)

  1. Anonymous
    Unregistered
    Posted 9 years ago #

    Alright, I did a quick search on this, and had some difficulty understanding this.
    When you go into the permalink page in the WordPress admin area, it gives you the options of mod rewrites. That's all cool, but I was wondering how I can have the actual posts saved into a directory labeled archives so instead of it saying something like :
    /index.php/archives/%postname%/
    it would say:
    /archives/%postname%/
    I'm sure this is something simple to do, I'm just overlooking it.
    Thanks for all of your help, I have had great support on these boards thus far!

  2. moshu
    Member
    Posted 9 years ago #

    What's wrong with index.php? Without that one you could hardly see anything at your blog's site. And your actual posts (i.e. the data) is saved alredy in the database. You need the index page to display them. Actually everything is displayed through/on that page.

  3. Anonymous
    Unregistered
    Posted 9 years ago #

    Yeah I know you need the index.php to display, I want the url to the actual post to just be like /archive/postname. Is that hard to do?

  4. ringmaster
    Member
    Posted 9 years ago #

    In order to use the mod_rewrite rules, you need to have mod_rewrite enabled on your server and must have written the rules to your .htaccess file.
    A simple explanation:
    When your web server (usually Apache) receives a request for a page, it funnels the URL through mod_rewrite first before determining what file to serve. mod_rewrite compares the URL to a list of rules (these are in your .htaccess file) and modifies the URL based on those rules.
    A rule could cause a URL that reads:
    http://www.example.com/archives/my-first-post
    To become:
    http://www.example.com/index.php?name=my-first-post
    The parameters are passed to WordPress, and your post is found and displayed!
    To create your .htaccess file in WordPress 1.2, you should go to your Options->Permalinks page and fill out the form there to your satisfaction. If you don't want the "index.php" in your URL, don't include it - you don't need it! Grab the code that WordPress generates and save it as a text file named ".htaccess". (Use Notepad!) Upload this file to the root (where your index.php is) of your blog.
    Hopefully, this will enable your mod_rewrite settings and you'll be able to use spiffy cruft-free URLs!
    If it's not working, first verify that you have the mod_rewrite rules copied and uploaded correctly. Sometimes this is difficult because files that start with a dot aren't visible by default on Linux systems.
    You should also check that your host supports custom mod_rewrite rules. Sometimes they turn off this option for hosting plans in the name of "security". There are plenty of hosts that don't do this.

  5. moshu
    Member
    Posted 9 years ago #

    No, it's not.
    Go into the admin > Options > Permalinks and edit your permalink structure. Read the instructions - everything is there.
    Instead of
    /index.php/archives/%postname%/
    you can use
    /archives/%postname%/
    but after clicking on the Update Permalink Structure (bottom right) you'll have to copy the new mod_rewrite rule into your htaccess file.

  6. Anonymous
    Unregistered
    Posted 9 years ago #

    Okay, I get all that, thanks. Here is what I did. I made the new .htaccess file on my server and then in the permalinks section said /archives/%postname%/. It did that, i copied the mod_rewrite info into the .htaccess file, saved it. I then refreshed my test blog and there is now a 404 error. The link to my blog is http://neczy.no-ip.com so you can see what is happening. All your help is appreciated.

  7. ringmaster
    Member
    Posted 9 years ago #

    Although this shouldn't cause the issue, you're not really supposed to have an "archives" directory. I mean, you'd never be able to access anything in it provided that your mod_rewrite stuff is configured correctly.
    But it doesn't look like your rules have taken. I think I know why...
    You're on a Windows server! Windows 2000 doesn't have mod_rewrite!
    You need Apache and mod_rewrite to use the mod_rewrite rules as-is.
    You have two options:
    1) Wait for WordPress 1.3 and use the new pathinfo stuff (you'll have to set your 404 page to your index, but that's easier to do on Windows).
    2) Buy some software like ISAPI Rewrite and use that. You'll have to tweak the rules from what WordPress provides, though, since the syntax is slightly different. I use ISAPI Rewrite on my box, and it's good.
    Otherwise, you'll have to stick with the crufty URLs. Sorry. :(

  8. Anonymous
    Unregistered
    Posted 9 years ago #

    Oh, thats cool then, Im only testing on my localhost, eventually it will go onto a normal linux server. Thanks for answering my question, and I can't believe i overlooked that hehe. I appreciate it! :D

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.