WordPress.org

Ready to get started?Download WordPress

Forums

Slash added at end of links (7 posts)

  1. notabbott
    Member
    Posted 8 years ago #

    There's something weird going on with my URL structure. WordPress is putting a slash after "index.php" and it's making a mess of everything. For instance, individual pages get tagged as "index.php/?page_id=1" and I get a "no input file specified." If I take the slash out manually, fine, but otherwise, every link on the site is non-functional.

    This is my first effort with WP, so I'm struggling with the parameters. I can't find *anything* in the "manage" tabs that looks like it would help. Changing the permalink structure doesn't help, either, but I might be doing that wrong, too -- does the .htaccess file go in the root of the WP directory or the actual blog directory? When I change *back* to the default permalink structure, it tells me I should change my .htaccess now, but doesn't say to *what*, and various bits of the documentation tell me that my version of WP should do that by itself.

    Is there a template file somewhere for the main page that controls the URL structure? Somebody throw me a bone here, this is really irritating. Site is http://www.soccercentraltime.com

  2. dutch_gecko
    Member
    Posted 8 years ago #

    If you go into your permalinks options there should be a box at the very bottom showing what .htaccess should look like at the moment. And yes, .htaccess goes into the root.

    Other thing to check is your permalink structure - if you can get away with it using one without index.php is far more search-engine friendly (your visitors will like it too), but if not, try the default option.

  3. notabbott
    Member
    Posted 8 years ago #

    Yeah, I get that if I change from the default to the other option, but not the other way around. And again, root of what? I've got my WordPress files in a separate directory from the blog itself. Neither seemed to fix this particular problem.

    Thanks.

  4. dutch_gecko
    Member
    Posted 8 years ago #

    D'oh, apologies for not reading properly.

    First of all, the .htaccess file should be in the blog directory.

    I think using the default means you don't need any rewrite rules, so open up your .htaccess and remove everything between <IfModule mod_rewrite.c> and </IfModule> inclusive. If that's all there is in the file you can remove it.

  5. notabbott
    Member
    Posted 8 years ago #

    Could it have something to do with this line:

    define('ABSPATH', dirname(__FILE__).'/');

    in the wp-config.php file? Would that append a slash at the end of everything?

  6. jfriesen
    Member
    Posted 8 years ago #

    Hmm, I need a litle help with this too.

    In the past, I've appended "index.php" to Options > Site URL while developing a blog site. This allowed me to work within the root directory of the site despite the presence of an index.htm file in there. Once the site was finished, I'd simply remove "index.php" from the site URL and delete the old index.htm file that was kicking around.

    That's worked just fine for me until now. I am setting up a new WP site on a server where an existing .htm based website lives. So, I append "index.php" to the site URL under Options--this should ensure that all links will work despite the presense of that index.htm file. Lo and behold, this setup is not working on this site. WordPress appends a trailing slash to the site preview URL (mysite.com/index.php/) and the web server tries to serve up the contents of a folder named /index.php/--which of course doesn't exist--throwing up 500 errors.

    Is this due to a difference in how this server is configured?

    I have nothing configured for permalinks.

    Can anyone tell me how I can work on this site even with that index.htm file in there? How can I append index.php to the site URL but make the server behave as expected?

    (Note: Moving the site to a development folder is NOT an option. The site uses the mudbomb WYSIWYG editor and you can't use that in a dev location because you'll then need to manually update all the links in your content once you move the site to the production location. See: http://wordpress.org/support/topic/36536)

    Thanks!

  7. jfriesen
    Member
    Posted 8 years ago #

    I think this must be a difference in server configuration. On a brand new site hosted by the same company, I cannot replicate the problem. The site in question was setup more than 5 years ago, so I wouldn't be surprised if there are differences between the sites' configurations.

    I'm close to resolving the problem using mod_rewrite:

    Options +SymlinksIfOwnerMatch
    <IfModule mod_rewrite.c>
    RewriteEngine On
    ReWriteCond %{DOCUMENT_ROOT}$1 -d
    RewriteRule ^index.php(/?)$ $1/index.php [L,R=301,NS]
    </IfModule>

    This successfully changes calls to index.php/ to index.php. Great! What it also does however is adds an extra slash after the domain name: mysite.com//index.php.

    So far, that hasn't caused any errors, but it looks a little messy.

    There is another problem though: calls to mysite.com/index.php generate a looping error.

    Can anyone suggest a better RewriteRule that will avoid these 2 problems?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic