Ready to get started?Download WordPress


www and trailing slash problem (20 posts)

  1. zoomer
    Posted 9 years ago #


    I have a problem with my WordPress, my site is consistent with http://www.mysite.com but when someone links to my blog not using a trailing slash (like http://www.mysite.com/blog instead of http://www.mysite.com/blog /) it redirects to http://mysite.com/blog/

    BUT i want to keep my "www' !! All of my site uses it, it is a consistancy thing and I believe that it is a VERY bad idea for search engines !

    Can someone help me keeping the www ? I'm a newbie and mod_rewrite is not something I will learn quickly I guess.

  2. zoomer
    Posted 9 years ago #

    It's very depressing to see so many messages with real problem and nobody answers

  3. It's very depressing to see so many messages with real problem and nobody answers

    I really have to laugh when I see this strategy. "Hey, maybe if I insult them, I can be guaranteed an answer to my original question."

    Of course, the real answer is that most of these "unanswered" questions have been answered and can be solved by a simple search. Yes, a simple 2-5 minute search could have spared you those 11 hours that you spent cooking up that witty comeback. You're lucky that I'm surprisingly in a good mood after that.


  4. Lorelle
    Posted 9 years ago #

    It's very depressing to see volunteers get whines from people who don't realize that the harder questions take some time to research, or for the knowledgable people to show up to answer the question.

    You can get information on permalink structure and rewrites in the WordPress Codex at http://codex.wordpress.org. And there is even more information on how to find more help in the WordPress Codex Troubleshooting section.

  5. tomhanna
    Posted 9 years ago #

    In the dashboard go to:

    Options: General

    Change both the WordPress Address (URI) and Blog Address (URI) to include the www.

    From several installs I recall that even if you put the www in during setup one or the other of these doesn't seem to end up with it, at least part of the time, but it's simple to change.

  6. Marc
    Posted 9 years ago #

    All that said "WWW" isn't useful any more and there is no valid reason to use it despite what the originator of this thread believes.

  7. zoomer
    Posted 9 years ago #

    All that said, I've found some posts with no answers at all and this is for months....so I was speaking for others too.
    Apparently when you "whine" the knowledgeable people seem to show up right away.
    Then for the latest thread, sorry: i'm newbie with wordpress but not with SEO and I know why I need this corrected.

    Now that I calmed down, I sincerely thank you for this help, it's very nice and I appreciate it.

  8. All that said, I've found some posts with no answers at all and this is for months....so I was speaking for others too.

    Let the other speak for themselves. Whether they found their answer of not, they have obviously moved on.

    Apparently when you "whine" the knowledgeable people seem to show up right away.

    I'll take that as a compliment.

  9. tomhanna
    Posted 9 years ago #


    "All that said" some spiders - noteably Google, at least according to their Adsense staff - treat http://www.something.com and something.com as separate URLS. While it's certainly fine to eliminate the www. altogether you don't want to have both, if it's a site where you don't want the negative implications of duplicate pages with identical content.

  10. skreak
    Posted 9 years ago #

    Hi there...

    Just wanted to bump this post not to renew the flaminess but to try to find a solution.

    I am in a similar situation to the first poster. I've read all of the posts mentioned but I haven't found a solution to my particular situation.

    I would like my blog to live at http://foo.com/wp/ . Everything else on my site links to http://foo.com/. However, my WP install thinks it lives at http://foo.com/wp and when a user hits that URL he or she is redirected to http://www.foo.com/wp/ .

    [Update: just to clarify, I do NOT want the www part in the domain name. The web server is set up to automatically add it when a user requests a URI which is a directory, and I don't have control over the web server.]

    I've tried to enter http://foo.com/wp/ in the admin interface for both Blog URI and WordPress address, but it strips the trailing slash off. At my host I am not able to use Apache RewriteRules. I've added a trailing slash by hand at the end of the header in my template, so the link to the blog page at the top works, but the RSS still uses a http://foo.com/wp as the URI for my blog.

    Can anyone help? Or at least point me to where in the code the URI is checked so I can override it myself?


  11. skippy
    Posted 9 years ago #

    Not entirely unrelated is this plugin, which might be of interest:

  12. Guntis
    Posted 9 years ago #

    I think it still doesn't solve my problem. In Options > General > WordPress address (URI): I have "http://www.adventisti.lv/blog" and the same in Blog address (URI): "http://www.adventisti.lv/blog". And when I click on my blog's title, I get an error, because I'm forwarded to "http://www.adventisti.lv/blog", exactly as written in preferences. However, in preferences I cannot add closing slash, as it's being stripped upon submitting changes. When I change WordPress address (URI): to "http://www.adventisti.lv/blog/index.php", everything works fine, except that all images are lost... Why I can't you allow simply add trailing slash? And we wouldn't have problems...

  13. VxJasonxV
    Posted 9 years ago #

    Some problems solved here (I'm looking at you skreak :) ):
    Enable or disable the www (FORCED, despite what the user puts in) for your site globally.

  14. Guntis
    Posted 9 years ago #

    It has nothing to do with www. The problem is not that I wouldn't have www, but that I cannot add trailing slash and in the result web server doesn't show anything without it... Actually it's redirecting user to another site... Try to enter this URL http://www.adventisti.lv/blog/ and then click on "Guntis' Blog" and see what I mean!

  15. VxJasonxV
    Posted 9 years ago #

    Guntis, like I said *some*.
    I wasn't necessarily speaking only about your problem.

  16. allonline
    Posted 9 years ago #


    I was wondering if this has been solved yet as ive had this problem since installing wordpress ages ago, i now run and today when trying to validate my feed in technorati it fails as its finding the url without the trailing slash.

    Started edit files and trying to add the slash in options but as others have found the slash doesnt save. Tried putting the url with index.php on the end and ended up trashing my blog, had to go into the database with phpadmin and edit the text that was save to remove the index page text as i couldnt login afterwards.

    I had edited the template files in places originally to add the slash as i noticed that various links were not working without it, when clicked i would be redirected to my site homepage as the blog page couldnt be found, noticed today while trying to solve the technorati problem that the feed xml text in the link field was also missing the trailing slash so in the end i edited the rdf and rss and rss2 files to add the slash after the blogurl variable and the feed now shows the correct link. Problem is i think when trying to cliam my feed with Technorati it is only reading the blogurl as in the database as saved under options os it goes to the wrong place and never finishes claiming it. I have logged a support ticket with them explaining what is happening so hopefully they will add my feed correctly.

    My website is http://www.coolwebpagetools.com the blog is located at http://www.coolwebpagetools.com/blog/

    If you leave the slash of as in http://www.coolwebpagetools.com/blog you will see what happens.

    As i say i have added the slash at the end in the php files wherever bloginfo_rss('url') appears so that it shows correctly but there are still places like on the admin screen for the visit blog link fetches just the url as in the database that i havent changed yet.

    The problem would disappear if wordpress allowed the trailing slash to be saved.

    For the rss feeds i edited the rdf, rss and rss 2 files in the blog root and changed the link tags to have a / after the blog url is called and now when i click on the feed link it shows up in the xml generated file.

    Dont have access to the appache config files so cant change them. Could do it with htaccess but i feel this should really be done within wordpress by allowing the correct path to be saved. As obviously any programs or readers looking for the url will find the wrong one if only picking it up from the info saved in options.

    Was hoping this had been fixed after upgrading to but it hasnt. Wont upgrade again until i know it going to work.



  17. niziol
    Posted 9 years ago #

    Hi there,

    I am also a "newbie" with WordPress. However, I suppose I have some shard of 'common sense' and the good manners my Mother taught me. This is a VOLUNTEER forum, as far as I know, no one here is paid to dig through pages and pages of rubbish from people who think Google is around simply so one can say "I love to Google myself".

    That being said and since I'm sick and tired of using the forums to SEARCH for solutions and only finding page after page of whining and bumps from twats who think solutions are found whilst ones finger is up ones nose. I have a solution or at least a starting point for YOU to figure out the answer to your dilemma:

    Adding this to your .htaccess file:
    RewriteRule ^(.*) http://www.YOURDOMAIN.EXT [L,R=301]

    Has worked for me in the past, thought outside of WordPress, to redirect any page without the www prefix to the same page with the prefix. Reading this Apache Reference: mod_rewrtie, RewriteRule should assist you. Failing that, you could try to Google something like "mod_rewrite", "Rewrite Rules" or things of that sort.


  18. vkaryl
    Posted 9 years ago #

    Masterful summation, niziol, thanks!

  19. danv
    Posted 9 years ago #

    Many people have said "just Google word press" but the one key thing is you need to use the word 'rewrite' to find anything useful. Which is not common sense for someone who is not in to Apache language.

    That's like saying 'look it up in the dictionary' when you don't know how to spell it :)

  20. TheHoff
    Posted 8 years ago #

    After all of that... here is the solution to the original poster's problem. Add the following to your main www directory's .htaccess. Change 'foo' to the directory of your WP blog.

    RewriteEngine on
    RewriteBase /
    RewriteRule ^foo$ foo/ [R]

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.