• A couple of weeks ago we moved our site over to GoDaddy hosting (Linux, Deluxe Plan). Ever since we did so, WordPress has seemed a little jacked up. The “auto_increment” option turned off for every table in the database and our Page and Category permalinks do not work without the trailing slash.

    In addition, we have switched our permalink structure and wanted to make sure we were getting all of the hits from the old structure, so we included a RewriteRule in the .htaccess file that redirects https://www.gadgetell.com/entry/3324/ to https://www.gadgetell.com/index.php?p=3324 and then finally to our new structure at https://www.gadgetell.com/2006/07/come-on-show-off-that-ipod-with-griffin%e2%80%99s-iclear/

    Ever since we moved over to GoDaddy, the /entry/3324 needs to have a trailing slash or else it doesn’t work.

    I’ve looked at my .htaccess file and it seems that WordPress has only written the code for my FeedBurner redirect plugin and something with (REQUEST_FILENAME) in it. Here is the full-text of the .htaccess.

    Any ideas? Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter bgswm1

    (@bgswm1)

    Any ideas?

    Been a lot of godaddy threads, but I don’t use their service, don’t remember specifics…

    Tried a search here?

    Thread Starter bgswm1

    (@bgswm1)

    Yeah I’ve tried searching over and over again. Doesn’t seem to be anything with this exact problem. Somehow I just need to make it so the trailing slash is optional, but I’m not exactly sure how. Ideas?

    I want to bring this thread back to life– I’m experiencing the same problem for a site I’m setting up for someone on a GoDaddy hosting account – he wants people to be able to access a page without the trailing slash – but doesn’t work. We even tried the Permalink Redirect plugin but we still get that ugly godaddy error page.

    I even tried going into options -> permalinks and having the permalinks be written without the trailing slash but that changed the url for the permalinks, but when you actually click on the title link it you get a 404 because for the non-trailing slashed url.

    Thanks!
    Lindsey

    Facing exactly the same problem as Lidesey and Bgswm1. If any of you folks have found a solution, please post it here.

    Thanks!

    kshitij

    Thread Starter bgswm1

    (@bgswm1)

    Just wanted to get this thread rolling again. Any thoughts on how to fix this issue? Any help is appreciated.

    Facing the same issue on godaddy.

    Strangely I was not facing the issue even on godaddy until I recently upgraded to wordpress 2.2

    Have been struggling to add a slash to the cateogry url for over an hour, no luck so far ??

    My permalink structure is /%year%/%monthnum%/%category%/%postname%.html

    so I can view the posts but the category and archive link URLs do ot have the / slash at the end. So only get a blank page. ??

    I am trying the Permalink Redirect Plugin but it seems to be doing exactly the opposite of what I want. It is stripping the slash after the category name. Can’t find a setting to add a slash after the category name

    Also pasted

    RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]

    in my .htaccess file as suggested at
    https://www.alistercameron.com/2007/01/12/two-wordpress-plugins-you-dont-need-and-shouldnt-use/

    but that seems to have no effect.

    Options +FollowSymLinks
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} ^[^\.]+[^/]$
    RewriteRule ^(.*)$ https://www.askapache.com/$1/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    Works for me.

    Ok I figured out another way to fix this… but this is a hack of the wp code so its risky (it works though).

    Edit the function get_category_link in the file /wp-includes/category-template.php

    function get_category_link($category_id) {
    	global $wp_rewrite;
    	$catlink = $wp_rewrite->get_category_permastruct();
    
    	if ( empty($catlink) ) {
    		$file = get_option('home') . '/';
    		$catlink = $file . '?cat=' . $category_id;
    	} else {
    		$category = &get_category($category_id);
    		$category_nicename = $category->category_nicename;
    
    		if ( $parent = $category->category_parent )
    			$category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename;
    
    		$catlink = str_replace('%category%', $category_nicename, $catlink);
    		$catlink = get_option('home') . user_trailingslashit($catlink, 'category');
    	}
    	return apply_filters('category_link', $catlink, $category_id);
    }

    Change
    $catlink = get_option('home') . user_trailingslashit($catlink, 'category');
    to
    $catlink = get_option('home') . user_trailingslashit($catlink, 'category') . '/';

    Ok I’m definately a newbie with WP’s code, but i’m getting the impression that their is some incorrect logic going on.. specifically in regards to the user_trailingslashit function.. I’m thinking that because some of us have permalinks that end in postname.html maybe that is causing the missing trailing slash problem…

    I was able to remove the /category/ base real easy, but what I can’t do is get the trailing slash to show up.. Oh well I don’t really use pages anyway. And I don’t recommend using the mod_rewrite code I posted earlier that adds the trailing slash, because it just hides the problem from you, search engines and source code still have bad links, its an internal problem I would guess. Again I really should mention I don’t really know what I’m doing with WP so you should probably just wait until they fix the bugs themselves.

    You can surf my blog to get a feel for what is working @askapache.com

    To remove the category base edit the get_category_permastruct function in /wp-includes/rewrite.php

    function get_category_permastruct() {
    		if (isset($this->category_structure)) {
    			return $this->category_structure;
    		}
    
    		if (empty($this->permalink_structure)) {
    			$this->category_structure = '';
    			return false;
    		}
    
    		if (empty($this->category_base))
    			$this->category_structure = $this->front . 'category/';
    		else
    			$this->category_structure = $this->category_base . '/';
    
    		$this->category_structure .= '%category%';
    
    		return $this->category_structure;
    	}

    From:

    if (empty($this->category_base))
    			$this->category_structure = $this->front . 'category/';
    		else
    			$this->category_structure = $this->category_base . '/';

    to:

    //if (empty($this->category_base))
    		//	$this->category_structure = $this->front . 'category/';
    		//else
    			$this->category_structure = '/';

    And of course you have to do modify the category-template.php as per the instructions in my previous post.

    Seems like a long way to go when an good .htacesss regexp would work. No, I won’t write one for you since your’e pretty much up to snuff. Just my hint to the folks that read this later that this isn’t IMO, the path to take. IMO.

    I have created support ticket for this issue, which also include the code for a plugin which can patch the problem:

    https://trac.www.ads-software.com/ticket/4652

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Category and Page Permalinks not working without trailing slash’ is closed to new replies.