WordPress.org

Ready to get started?Download WordPress

Forums

'Pages' and Permalinks (16 posts)

  1. brianburns_net
    Member
    Posted 9 years ago #

    I notice that when I create pages that the a line is created in the permalink .htacccess config file for each page, which is different behavior than for blog entries Unless I update my .htaccess file the permalink will not work.

    1.) Do I have to update my .htaccess file every time I add a page or change a slug?

    2.) If I make my .htaccess file writable server to get around this, what permissions do I need to give it to make it secure? I am not very familiar with unix permissions.

  2. error
    Member
    Posted 9 years ago #

    Your web host will have to make the .htaccess file writable by the web server process. This isn't something you can do yourself. I recommend you have the uid set to your uid, and the gid set to the gid that the Web server runs under, with permissions of 0660.

    You do need to update the .htaccess file every time you make a new post/page or change a slug. If you can't do this, and your web host won't cooperate, you can add /index.php/ into the permalink structure and WP will handle it that way instead. For instance: /wordpress/index.php/%year%/%monthnum%/%day%/%postname%/

    If you do this, everything will go through /index.php without needing rewrite rules, but your permalinks will be a lot longer.

  3. indieb0i
    Member
    Posted 9 years ago #

    You do not need to update the .htaccess after each post. You only need to update it if you create a page or change the permalink structure.

  4. Jax
    Member
    Posted 9 years ago #

    My .htaccess is set to 666. Yet WP does not write the rewrite rules to my .htaccess files. Can anyone help out?

  5. error
    Member
    Posted 9 years ago #

    Click Options » Permalinks. If the .htaccess section appears, then it is not writable. Go pull a directory listing on the .htaccess file. If it really is set to 666, it will look something like:

    -rw-rw-rw- 1 xavierroy users 5319 Jan 5 04:55 .htaccess

    If all three rws do not appear, it's not world writable. On my host, it appears as:

    -rw-rw---- 1 error apache 9678 Jan 5 19:43 .htaccess

    In this case it is not world writable, but it is writable by the web server apache. Which means other users on the same web host can't screw with it.

  6. Jax
    Member
    Posted 9 years ago #

    My directory listing shows:
    .htaccess HTACCESS File 4676 xavier xavier rw-rw-rw- Jan 5 10:40

    I created a couple of static pages (archives and links). WP is not updating the .htaccess file. Infact, when I ty to edit the file through the WP Manage > Files interface, I get a Forbidden error message. Even when I have set the file mode to 666.

  7. Jax
    Member
    Posted 9 years ago #

    My directory listing shows:
    .htaccess HTACCESS File 4676 xavier xavier rw-rw-rw- Jan 5 10:40

    I created a couple of static pages (archives and links). WP is not updating the .htaccess file. Infact, when I ty to edit the file through the WP Manage > Files interface, I get a Forbidden error message. Even when I have set the file mode to 666.

  8. Jax
    Member
    Posted 9 years ago #

    My directory listing shows:
    .htaccess HTACCESS File 4676 xavier xavier rw-rw-rw- Jan 5 10:40

    I created a couple of static pages (archives and links). WP is not updating the .htaccess file. Infact, when I ty to edit the file through the WP Manage > Files interface, I get a Forbidden error message. Even when I have set the file mode to 666.

  9. dille
    Member
    Posted 9 years ago #

    What happens if you apply 777 privileges to the directory containing the .htaccess file?

  10. Lorelle
    Member
    Posted 9 years ago #

    Just want to thank everyone here for helping me. I've been fighting problems with the permalink for weeks and finally figured it out.

    The missing key is that the .htaccess file HAS to be in the wordpress main directory. I kept making changes to my main .htaccess file in the parent of wordpress. Didn't know I could have more than one .htaccess file. Your discussion helped me figure it out and now it works.

    Thanks!

  11. mcnicks
    Member
    Posted 9 years ago #

    I posted this elsewhere but I thought it would be relevant to this topic. I use a single .htaccess file outside of my blog directory to handle my rewrites so the automatic updates for pages were giving me some grief. To get round this I wrote a generic RewriteRule that should (ha!) handle all requests for pages:

    RewriteCond %{REQUEST_URI} ^.*/$
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*/)?(.*)/$ /blog/index.php?pagename=$2 [QSA,L]

    The first RewriteCond checks whether the requested URI ends with a "/" character. The second checks whether the URI refers to a directory that exists. If it does not, then I assume that it is a request for a WP page. The RewriteRule gets invoked to redirect to the appropriate page in WordPress. This saves having to continually edit the WP .htaccess file as new pages are created.

    The downside to the assumption is that, if it is not actually a request for a page, then WP has to handle dishing back the 404 error code.

    David

  12. Lorelle
    Member
    Posted 9 years ago #

    Still, this is brilliant. Thanks!

  13. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    Here is what I use.

  14. Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    @rboren - What's the disadvantage? Or, why is this not the standard WordPress method?, if that's a more pertinent question.

  15. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    With this method, you won't get 404s in your server log since everything is redirected to WP. Even though WP itself will send 404 headers back to the client if it can't match the requested URI against one of its internal rewrite rules, some people are still resistant to this method. Personally, I would like to switch to this method since it makes the rewrite rules more portable and maintainable, but I don't have enough energy to argue for it right now. ;-)

  16. jarle
    Member
    Posted 9 years ago #

    Another thing with Pages and permalinks:
    It seems to me that linking to Pages in your template index file must be absolute (not relative as one might think from reading http://codex.wordpress.org/Pages) if to work from archives etc., i.e. from all kinds of permalink structures.
    Or?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.