WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] An issue with permalinks / htaccess (26 posts)

  1. shog
    Member
    Posted 2 years ago #

    Hi guys. My problem is really simple, but I don't know how to fix it. I want to use permalinks /%postname% on my site, but it doesn't work. Permalinks are working correctly when did in form like: /index.php/%postname%. All of us know that links with index.php are quite annoying and I want to get rid of this, but I don't know how. I've modified my .htaccess file with rewrite (my server has mod_rewrite enabled) with no effect. What's more, my .htaccess file doesn't work at all - not only with commands connected with rewrite, but even with eg DirectoryIndex. I tried to do something with custom 404, but with this I'm getting redirected to index when trying to enter any article/category. I'm out of ideas, do you have any clues how can I deal with this problem? Thanks for any replies.

  2. Are you on a Windows server by any chance?

    Windows servers typically do not recognize .htaccess files, and also often stick that extra index.php in there.

    Best solution: I recommend you switch to Linux hosting if at all possible.

    Otherwise, tell us what server you're using (exact type & version) and I can do some Googling for you as this issue has come up before, but solutions are server-specific.

  3. shog
    Member
    Posted 2 years ago #

    phpinfo() shows Linux as System. Where can I find more detailed information about type & version?

  4. The detailed server info was only relevant if you were on a Windows server.

    Since you're running on Linux, I would put in a ticket with your web host to get their help finding out why your .htaccess is not working at all. Once you get the .htaccess working, hopefully your /index.php issue will get resolved, once the WP rewrite rules are working properly.

  5. shog
    Member
    Posted 2 years ago #

    Thanks for your replies, I'll ask my webhost for help.

    ... anyway it's really weird.

  6. shog
    Member
    Posted 2 years ago #

    I got a reply. They said, that .htaccess files (including mod_rewrite) on the all of their servers are working properly and it must be wordpress' fault. Any new ideas?

  7. Does your .htaccess have any blank lines at the beginning or end of it? That can screw it up.

  8. shog
    Member
    Posted 2 years ago #

    It doesn't matter, .htaccess doesn't work even with or without blank lines.

  9. Hi shog, perhaps a longshot, but what program are you using to edit the .htaccess file?

    Is it a true plain-text app or a real code editor?

    I've seen .htaccess files get totally messed up when unknowingly edited in a program that was adding extra "junk" to the file - even Dreamweaver in code view is no good for editing .htaccess, for example.

    TextEdit for Mac or Notepad for PC - set to plain-text mode - are two good bets and everyone usually already has them.

  10. shog
    Member
    Posted 2 years ago #

    I'm usually using Notepad2, but even with default Notepad with plain-text mode I can do nothing. Btw. when I delete .htaccess file, nothing happens. File generates when I set my permalink structure to /%postname/, but it's all - the file is only generated, it still doesn't work.

  11. Could you paste the contents of that auto-generated .htaccess into a Pastebin and then give the link here?

    http://pastebin.com/

  12. shog
    Member
    Posted 2 years ago #

  13. Thanks. Could I get a link to your site as well?

  14. shog
    Member
    Posted 2 years ago #

  15. I see your links like:

    http://www.czasfutbolu.pl/index.php/kategoria/wywiady/

    http://www.czasfutbolu.pl/index.php/radoslaw-gilewicz-o-kadrze-na-100-dni-przed-euro/

    Those look an awful lot like the PATHINFO-type links described here.

    I'm not sure why your site would be using those instead of mod_rewrite if you say your server has mod_rewrite enabled.

    What is your custom permalink set to in Settings?

    I'm also going to try to get another set of eyes or two on this.

  16. my server has mod_rewrite enabled

    In the meantime, could you perhaps double-check this in your phpinfo() file?

  17. What's more, my .htaccess file doesn't work at all - not only with commands connected with rewrite, but even with eg DirectoryIndex. I tried to do something with custom 404, but with this I'm getting redirected to index when trying to enter any article/category.

    Going back to that ... NOTHING in .htaccess works? That goes back to the host, not you, doing something wrong.

    Are you on Yahoo servers perchance? I know they did something daft where you HAVE to use index.php.

  18. Good thinking, but Yahoo doesn't even allow .htacess files, yet this host says, "that .htaccess files (including mod_rewrite) on the all of their servers are working properly and it must be wordpress' fault." :-(

    I used a host-checking tool and it looks like something called LeaseWeb.

  19. Except clearly not, and the functionality of .htaccess for NON WordPress things, like a custom 404, cannot be affected by WP, unless you're using a plugin for redirects.

    Turn off all your plugins.

    Put this, and ONLY this, in your .htaccess:

    Redirect 301 /googletest http://google.com

    Go to http://www.czasfutbolu.pl/googletest

    If it borks, it ain't WordPress, it's your server. Get a stick and hit your host.

  20. shog
    Member
    Posted 2 years ago #

    I'm not sure why your site would be using those instead of mod_rewrite if you say your server has mod_rewrite enabled. What is your custom permalink set to in Settings?

    I set permalink template to '/index.php/%postname%'. It's the only permalink type working.

    In the meantime, could you perhaps double-check this in your phpinfo() file?

    Yes, I'm sure mod_rewrite is enabled. What's more, my hosting provider writes this constantly in every message.

    Going back to that ... NOTHING in .htaccess works? That goes back to the host, not you, doing something wrong. Are you on Yahoo servers perchance? I know they did something daft where you HAVE to use index.php.

    Unfortunately NOTHING works, really. :/ My hosting is located in Poland, it's webd.pl.

    If it borks, it ain't WordPress, it's your server. Get a stick and hit your host.

    404 error.

    edit: By the way, I've noticed something interesting and I think it could be the answer for all weird things we got here. All files are located in: [main]/czasfutbolu.pl/public_html - there I have only wordpress and this htaccess file. But in my main folder I have public_html folder also (path: [main]/public_html/) and everything I have there is adequate to address: http://www.maciejro.webd.pl (this is my 'parent' address, without a domain). When I put a .htaccess file there, it works. It doesn't work only in path mentioned above. I would copy all files just to /public_html/, but in this situation I don't have my domain corresponding to this.

  21. That sounds like czasfutbolu.pl is an add-on domain? Is that right?

  22. shog
    Member
    Posted 2 years ago #

    Yes, it is. I couldn't notice that before, because my friend was doing all things connected with domains/users/redirecting etc.

  23. shog
    Member
    Posted 2 years ago #

    Omg, finally got it working. ;) It was because of this subdomain. Thanks for all the posts here.

  24. Awesome! What did you do to get it working? You never know, it might help someone else in the future. :-)

  25. shog
    Member
    Posted 2 years ago #

    It was really simple thing. :p Just noticed that there was a subdomain maciejro.maciejro.webd.pl and domain czasfutbolu.pl was connected to this address. When I removed this unnecessary subdomain and moved all the files just to /public_html folder and redirected domain to main folder - everything started to work as it should. Conclusion is simple - on http://www.webd.pl hosting .htaccess files are working properly only in /public_html folder.

  26. Excellent - thanks for letting us know the resolution, glad it was an easy fix in the end.

Topic Closed

This topic has been closed to new replies.

About this Topic