ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Having trouble with Structure, pagination, and url structure on index page

May 28, 2010 6:40pm

Subscribe [2]
  • #1 / May 28, 2010 6:40pm

    gogglez

    23 posts

    I’m having trouble getting pagination to work with a sites index page. I’m able to get it to work on all other pages of the site, and I have a feeling it’s because of the url structure. For example, here is how the url looks when the code fails to make pagination work:

    <a href="http://example.com/?page=2">http://example.com/?page=2</a>

    And here is how it looks when it succeeds:

    <a href="http://example.com/section?page=2">http://example.com/section?page=2</a>

    Both templates use identical code, simply calling a different weblog. What I’m wondering is if I should make it so my index page says something like:

    <a href="http://example.com/index?page=2">http://example.com/index?page=2</a>

    And if so, would I do this with my .htaccess file? If it matters, here is my .htaccess file:

    Action php5-script /gs-bin/php-5.2.6-1
    AddHandler php5-script .php
    
    # -- LG .htaccess Generator Start --
    
    # secure .htaccess file
    <Files .htaccess>
     order allow,deny
     deny from all
    </Files>
    
    # Dont list files in index pages
    IndexIgnore *
    
    # EE 404 page for missing pages
    ErrorDocument 404 /index.php?/{ee:404}
    
    # Simple 404 for missing files
    <FilesMatch "(\.jpe?g|gif|png|bmp)$">
      ErrorDocument 404 "File Not Found"
    </FilesMatch>
    
    RewriteEngine On
    
    RewriteCond $1 !^(images|system|themes|favicon\.ico|robots\.txt|path\.php|index\.php|([a-z0-9-]+).html) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    RewriteBase /
    
    # Remove the www
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
    RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # Rewrite homepage urls that have the Google Analyticis query string
    # CampaignMonitor adds the query string in their emails
    # "site" is the template group
    # "index" is the template name
    # The template group and template should point to your sites index
    RewriteCond %{QUERY_STRING} ^utm_medium
    RewriteCond %{REQUEST_URI} ^/$ [NC]
    RewriteRule (.*) /index.php?/pages/index/&%{QUERY_STRING} [L]
    
    # Add a trailing slash to paths without an extension
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
    RewriteRule ^(.*)$ $1/ [L,R=301]
    
    # Remove index.php
    # Uses the "include method"
    # <a href="http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method">http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method</a>
    RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^example.com [NC] 
    RewriteRule ^(.*)$ <a href="http://www.example.com/$1">http://www.example.com/$1</a> [L,R=301]

    Thanks for any help… I hate to bring a new topic in about this because I know it’s a common problem (Or at least pagination with Structure is), but solutions I have seen around don’t seem to help me. I think I just need a nudge in the right direction.

  • #2 / Jun 03, 2010 4:43pm

    rockthenroll

    485 posts

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases