The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Child pages, slugs and URLs
#1
I just noticed (realized) that child/parent relationships are not "enforced" when using pretty URLs.

For example, I have this page:
http://www.cartocopia.com/portfolio/ascadia/

Which doesn't need the portfolio parent page in the url, and this also works:
http://www.cartocopia.com/ascadia/

and even this:
http://www.cartocopia.com/it/does/not/ma...g/ascadia/

Does anyone have any suggestion on how to enforce the URL structure and make only the first work?

-Rob A>
Reply
#2
RobA Wrote:I just noticed (realized) that child/parent relationships are not "enforced" when using pretty URLs.
...
Does anyone have any suggestion on how to enforce the URL structure and make only the first work?

-Rob A>

1. Change the RewriteRule in your .htaccess file to allow only one and two levels, something like:
Code:
RewriteRule ^([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/?$ index.php?id=$2&parent=$1 [QSA,L]
(Not sure about the order or the flags, you'll have to try or read the apache doc)

2. Write a plugin, which tests the parent parameter in the hook index-pretemplate and shows 404 Page not found, if it is incorrect.

3. Submit the plugin to Extend ;-)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
RobA Wrote:Does anyone have any suggestion on how to enforce the URL structure and make only the first work?

In gsconfig.php:
Code:
# Enable Canonical Redirects?
define('GSCANONICAL', 1);

But it won't work well with some plugins (e.g. those using url parameters)
Reply
#4
Carlos Wrote:But it won't work well with some plugins (e.g. those using url parameters)

Thanks Carlos. That's too bad.

-Rob A>
Reply
#5
RobA Wrote:
Carlos Wrote:But it won't work well with some plugins (e.g. those using url parameters)

Thanks Carlos. That's too bad.

Well... it's can be useful for some sites...

A workaround could be: a plugin that works like GS's canonical redirect, but lets you exclude pages (like your Simplecache plugin). But it's not a complete solution -- those excluded pages would still be accesible with different url's.
Reply
#6
Roba: you could try with grabbing whole url, explode it into array, and leave only domain + last 2 array elements.
Simplified solution: more than 3 (don't remember how http://www.domain.tld/ is being split) elements -> redirect to 404.
A bit advanced is to redirect the user after merging array elements, looking if the target page physically exist, and then serve the page.

I've been doing something similar, to see if the page stays in a fixed location (domain/location/page.ext instead of /location/location2/location3/page.ext) and serve a dedicated content. The problem is that it would have to be scallable if you'd like to share your code. Let's not forget about plugins and their content, as array will contain also php variables.

Seems not that good idea as I firstly thought.
Addons: blue business theme, Online Visitors, Notepad
Reply
#7
@RobA

A quick hack to make SimpleCache plugin enforce canonical URLs. Edit simplecache.php, line 48, insert this:
Code:
if ($_SERVER['REQUEST_URI'] != find_url(return_page_slug(), get_parent(false), 'relative')) {
        redirect(find_url(return_page_slug(), get_parent(false)));
      }

(Just after the if(!in_array(return_page_slug() ... line)

You will be redirected to the correct URL (structure defined in GS settings). Pages excluded from caching will not be checked/redirected.

Why choosing SimpleCache for this experiment? Because it has more or less the same problem with url parameters as canonical redirection.

PS I might have tried to do a mini-plugin that reads SimpleCache's config and does all this, instead of patching the plugin, but there's a problem: as it would have to be hooked to 'index-pretemplate', I'm not sure if it would always (or on any system) be fired before SimpleCache (or any other plugin that uses that hook).
Reply




Users browsing this thread: 3 Guest(s)