Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-02-06 08:31:07

cabin-chair
New Member
Registered: 2018-02-06
Posts: 2

Specially Designed Path

Hi,

Have seen Textpattern paths where, after the domain, there is something like this:

PAGENAME.php?X=ANOTHER-PAGE-NAME

https://dev-demo.eu.textpattern.co/index.php?c=meaningful-labor
https://dev-demo.eu.textpattern.co/index.php?c=hope-for-the-future

http://www.bloobloobloo.blablabla.mx/index.php?id=57

and even two levels

https://www.blablabla.com/?filter=Use&q=Bathro

Need to create a install of textpattern where we have

content.php?section=architects&article=ghery
content.php?section=painters&article=picasso
content.php?section=cities&article=oregon

so that we can preserve the same URL structure of existing pages

How could we do that?

Thanks!

CC

Anonymised URLs –– Uli

Last edited by cabin-chair (2018-02-06 12:35:21)

Offline

#2 2018-02-07 09:59:44

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,190
Website

Re: Specially Designed Path

Hi cabin-chair and welcome,

The links with domain.com/index.php?… are typically standard filter queries, for example:

  • ?s={section-name} = article list filtered by section
  • ?c={category-name} = article list filtered by category
  • ?id={number} = single article with article-id
  • ?q={search-term} = search articles
  • ?p={page-number} = article pagination

etc. The index.php is always the standard file through which everything is routed but with so-called clean URLs you never see it except in such special cases. It’s hard-coded into much of Textpattern, so renaming it to content.php will break Textpattern. In general, you don’t need to remember any of this, as they’re generated automatically when required.

For your setup, the best way I can think of would be to use your .htaccess file to translate all incoming URLs with content.php to a regular Textpattern clean URL, e.g.:

content.php?section=architects&article=ghery -> architects/ghery
content.php?section=painters&article=picasso -> painters/picasso
content.php?section=cities&article=oregon -> cities/oregon

That changes your URL structure in the long term, but all incoming links that might be in search machines or other links are automatically re-routed to the new location and search machines are informed of the location change. To do that, you need to add this to your .htaccess file (you may have to switch on “show hidden files” in your FTP program to see it):

RewriteRule ^content.php\?section=(.+)&article=(.+)$ http://www.yourdomain.com/$1/$2 [R=301]

(replacing yourdomain.com with your own URL). Place that after RewriteEngine On and RewriteBase, e.g. around line 11 of your htaccess file. The R=301 means send a notice that the location has changed.

In Textpattern you would set up sections, e.g. “architects”, “artists” and “cities” and write the articles “Gehry”, “Picasso” and “Oregon” and assign them to the respective sections. Textpattern takes care of the rest. To make sure your links redirect your “article url title” must match that of your previous system, e.g. your article title at the top can be “Frank Gehry – Master of Organic Forms” but your article url title would be ghery (if misspelt in the original, then misspelt here too ;-).


TXP Builders – finely-crafted code, design and txp

Offline

#3 2018-02-07 10:32:53

cabin-chair
New Member
Registered: 2018-02-06
Posts: 2

Re: Specially Designed Path

Hi Jakob,

Textpattern is SUPER! When I see the detailed and kind response you’ve written I feel grateful. Thank you, Jacob!!

Seems like we need to keep the exact same URL structure. Will work with what you’ve suggested and see what’s possible.

Thanks again,

CC

Offline

Board footer

Powered by FluxBB