Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-04 12:27:42

Kelon
Member
Registered: 2009-10-18
Posts: 16

Forcing index.php for clean urls???

Hi.. thanks for stopping by. I’ve never been good with rewrite rules… keep meaning to sit and methodically work till my brain gets it all.

Linux server….
Installed Textpattern with seems (having checked posts here) the standard .htaccess rules.

Behaviour as ‘out of box’:.. Messy URL’s – tick. Clean URL’s – no.

Messing about trying to get the size and the shape of what precisely wasn’t working I added the full url into the Textpattern admin preferences “site url” dialogue thus: ‘my_site_address.com/index.php’ … ta-da clean urls work.. only with my_site_address.com/index.php/clean/url/here in all of ‘em, ….hum. Because it’s forcing everything through index.php… which is correct, it should be yes?

Implications? Little rewrite tweak to research I presume…

htaccess contents:---------------

RewriteBase /

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]

RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php        <<<<<------------- is this not working as it should?

RewriteCond %{HTTP:Authorization}  !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

AddHandler headers .jpg .gif .png

--------------------- end htaccess contents

Thanks for your look over. Any pointers appreciated.. happy to do the leg work and find out for myself… just the going round in circles gives me a head ache, know what I mean…. ;-) Cheers.

Last edited by Kelon (2009-11-04 12:33:27)

Offline

#2 2009-11-04 12:46:43

Kelon
Member
Registered: 2009-10-18
Posts: 16

Re: Forcing index.php for clean urls???

Addendum… of course there are all sorts of issues crop up as a result of specifying the full index.php url in the site url dialogue box…. which I dare say I could think a way round… but it would all get very silly… so I need to sort it and wouldn’t recommend anyone else doing the same thing …. :-)

Offline

#3 2009-11-04 17:09:36

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Forcing index.php for clean urls???

So you’re saying that my_site_address.com in the “site url” dialogue doesn’t work? Does your host support mod_rewrite?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#4 2009-11-04 17:51:01

Kelon
Member
Registered: 2009-10-18
Posts: 16

Re: Forcing index.php for clean urls???

Hi, thanks for responding.

In the admin site url dialogue….
1) ‘my_site_address.com’ ….works messy url …..doesn’t work clean url

2) ‘my_site_address.com/index.php’ …..works clean urls

Having examined how the messy url works… all requests need to be processed by index.php? (This is really basic stuff I’m learning here isn’t it :-) I’m presuming that for whatever reason the .htaccess is not rewriting the /section/id/title url to the index.php so the server is looking for my_site_address.com/section/id/title rather than my_site_address.com/index.php/section/id/title. This will be easy to do though I’m not sure that I’m right thinking that’s how it’s supposed to work.

(There’s a rewrite in a subdirectory – not Textpattern associated – which is working… though the linux phpinfo isn’t what I’m used to looking at and I can’t see any “loaded modules” row in any table… … so I’m not sure whether rewrite only ‘seems’ to be working as I understand it can do from posts I’ve been reading)

Last edited by Kelon (2009-11-04 17:56:59)

Offline

#5 2009-11-04 20:11:55

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Forcing index.php for clean urls???

Can you post your full diagnostics please?

Offline

#6 2009-11-04 20:34:32

Kelon
Member
Registered: 2009-10-18
Posts: 16

Re: Forcing index.php for clean urls???

Hi Els, thanks for sorting out where I should have been posting…

Textpattern version: 4.2.0 (r3275)
Last Update: 2009-11-02 18:00:44/2009-11-03 23:06:00
Document root: /home/account/www_site
$path_to_site: /home/account/www_site
Textpattern path: /home/account/www_site/textpattern
Permanent link mode: messy
Temporary directory path: /home/account/www_site/textpattern/tmp
Site URL: site.co.uk
PHP version: 5.2.9
GD Image Library: bundled (2.0.34 compatible); supported formats: GIF, JPG, PNG.
Server TZ: UTC
Server Local Time: 2009-11-04 20:28:35
DST enabled?: 0
Automatically adjust DST setting?: 0
Time Zone: Europe/London (0)
MySQL: 5.0.81-community-log
Locale: en_GB.UTF-8
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
PHP Server API: cgi
RFC 2616 headers: 0
Server OS: Linux 2.6.27.10-grsec
Active plugins: rsx_page_number-4.0, cbs_category_list-0.9, rss_auto_excerpt-0.5, hak_article_image-0.6.3, rcb_image_index-0.1, dms_article_image-0.1m, rvm_if_this_article-0.1, smd_gallery-0.51, lam_accordion_section-0.2, lam_browse_by-0.1, lam_show_recent_articles-0.1, smd_lib-0.36
Admin-side theme: classic 4.2.0

Pre-flight check:
————————————
The following PHP functions (which may be necessary to run Textpattern) are disabled on your server: show_source
————————————

.htaccess file contents:
————————————
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) – [PT,L]

RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php

RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* – [E=REMOTE_USER:%{HTTP:Authorization}]

AddHandler headers .jpg .gif .png
————————————

Last edited by Kelon (2009-11-04 20:36:05)

Offline

#7 2009-11-04 22:18:10

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Forcing index.php for clean urls???

Hi Kelon, sorry I wasn’t clear: in the Diagnostics tab, at the bottom, you can choose ‘Detail: High’. Would you mind posting that output?

Offline

#8 2009-11-04 23:11:55

Kelon
Member
Registered: 2009-10-18
Posts: 16

Re: Forcing index.php for clean urls???

Hi Els
No worries, kind of you to take the time. Must admit I was a little stumped as to what the ‘short’ version could be telling you.
Are you thinking it’s something in the Textpattern php files or database? Though I’ve not the faintest idea in truth, somehow I don’t think it’s getting that far… the GET request URL’s are properly formed in the code output to the browser as I’d expect… surely it’s the server that’s not then routing the request (rewriting it). Have I been unclear, I am sorry: it’s the GET request that fails and results in a 404 not found error. The clean urls are correctly output as part of the web page syntax to the browser… ie: <a href=“http://my_site.com/journal/7/title-here”>Title Here</a>.

I was going to play with htaccess rewrite tonight but got somewhat distracted by some storming music … so have been chilling instead :-)

Regards..,

Continuation of diagnostics above:
—————————————————————————————————

Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: latin1
character_set_filesystem: binary
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
17 Tables: OK

10 Custom Fields: custom_1, custom_2, custom_3, custom_4, custom_5, custom_6, custom_7, custom_8, custom_9, custom_10 (10)

PHP extensions: zip/1.8.11, libxml, xsl/0.1, xmlwriter/0.1, xmlrpc/0.51, dom/20031129, xmlreader/0.1, xml, wddx, tokenizer/0.1, tidy/2.0, session, pcre, SimpleXML/0.1, sockets, soap, snmp, SPL/0.2, standard/5.2.9, Reflection/0.1, posix, mysqli/0.1, mysql/1.0, mcrypt, mbstring, json/1.2.1, imap, iconv, hash/1.0, gettext, gd, ftp, filter/0.11.0, exif/1.4 $Id: exif.c,v 1.173.2.5.2.27 2008/12/31 11:17:37 sebastian Exp $, date/5.2.9, curl, ctype, calendar, bcmath, zlib/1.1, openssl, cgi, PDO/1.0.4dev, pdo_sqlite/1.0.1, SQLite/2.0-dev, pdo_mysql/1.0.2, ionCube Loader, Zend Optimizer

/home/account/www_site/index.php: r3189 (8becf5ea8d9ced7d05b2433dfbabf868)
/home/account/www_site/css.php: r3189 (7a0cc56c9dc585e56aab80bc0fb22c53)
/home/account/www_site/textpattern/css.php: r3189 (459137eeb00bb07136001528ce724192)
/home/account/www_site/textpattern/include/txp_admin.php: r3203 (26c4f327450f66618fe82b06fb8b9e70)
/home/account/www_site/textpattern/include/txp_article.php: r3246 (9211f37e8ba873c78b0c46186896d6b2)
/home/account/www_site/textpattern/include/txp_auth.php: r3250 (6be154f05fca4e83c4a4947c8635afd7)
/home/account/www_site/textpattern/include/txp_category.php: r3203 (2350c33b6acc663b56ba982bc479c920)
/home/account/www_site/textpattern/include/txp_css.php: r3118 (bfd945a0b268c60f7b71b6535c06154e)
/home/account/www_site/textpattern/include/txp_diag.php: r3267 (c03f4b7e28c2f8e5050924b6caf2f61f)
/home/account/www_site/textpattern/include/txp_discuss.php: r3185 (9b08de9e4f2df7160105ff218134ec67)
/home/account/www_site/textpattern/include/txp_file.php: r3200 (dc26e8f4cbb1821c466c14926c8a10ca)
/home/account/www_site/textpattern/include/txp_form.php: r3260 (6ad789075a6a1811d027f5e4043b845d)
/home/account/www_site/textpattern/include/txp_image.php: r3267 (814b6421cb2e2df073d0d6bf05c252bf)
/home/account/www_site/textpattern/include/txp_import.php: r3203 (fb18d629321a93472674dbd4abbfc63c)
/home/account/www_site/textpattern/include/txp_link.php: r3203 (7dee2f899aa22712e4f5f1005c6853b0)
/home/account/www_site/textpattern/include/txp_list.php: r3203 (2dd80b98cb76b0532133f6d7c2bcccb9)
/home/account/www_site/textpattern/include/txp_log.php: r3203 (a97af8e5ed62605ab0111e45266300cb)
/home/account/www_site/textpattern/include/txp_page.php: r3260 (ef00267f34445a33ce0f2e453c3a20db)
/home/account/www_site/textpattern/include/txp_plugin.php: r3203 (8c1691e89ccfc8a8f9160e66efce2b09)
/home/account/www_site/textpattern/include/txp_prefs.php: r3235 (9833b1a7cbd01def4ceb40f8cdf01a3b)
/home/account/www_site/textpattern/include/txp_preview.php: r1238 (cc7d08574508c8ec1e4c5281d534d6e3)
/home/account/www_site/textpattern/include/txp_section.php: r3203 (1c7eec911a015b72e42d5cea903be426)
/home/account/www_site/textpattern/include/txp_tag.php: r3195 (280f0fd2e6f50e6a0f13490ea5dfc1f4)
/home/account/www_site/textpattern/index.php: r3275 (6e259f5394d65617809d25e4823de174)
/home/account/www_site/textpattern/jquery.js: unknown (bb381e2d19d8eace86b34d20759491a5)
/home/account/www_site/textpattern/lib/IXRClass.php: r2932 (6c533bb271087338aa19ca0b78b1810f)
/home/account/www_site/textpattern/lib/admin_config.php: r3202 (524b829d7c73e5db26415633e799e350)
/home/account/www_site/textpattern/lib/class.thumb.php: r3107 (0e3f7b9da4b0c77f9b75263142598902)
/home/account/www_site/textpattern/lib/classTextile.php: r2812 (b3e4cd9bd5fb469fabdebb2c0376f7e7)
/home/account/www_site/textpattern/lib/constants.php: r3133 (b296756aedaf98b6f9420359dd07abdb)
/home/account/www_site/textpattern/lib/taglib.php: r2868 (a0662fa399fb16e837e8852f044dade9)
/home/account/www_site/textpattern/lib/txplib_admin.php: r3047 (54de3f807984122ebe9b8b955e5189f4)
/home/account/www_site/textpattern/lib/txplib_db.php: r3250 (c29e316100ae6ed42d6ec51506388b5f)
/home/account/www_site/textpattern/lib/txplib_forms.php: r3256 (2623d94099735edc0e7a51309c26665d)
/home/account/www_site/textpattern/lib/txplib_head.php: r3265 (4492de4935f8352357f0809d9d89516f)
/home/account/www_site/textpattern/lib/txplib_html.php: r3255 (adb712630ad3bbe59c5f716befa33f0a)
/home/account/www_site/textpattern/lib/txplib_misc.php: r3271 (68d443f0f20acec5e86857a823c2b4e2)
/home/account/www_site/textpattern/lib/txplib_theme.php: r3269 (83bcbeffa883bed5f0af951dda7be2fb)
/home/account/www_site/textpattern/lib/txplib_update.php: r2812 (5e6821f06aeafe50b54e5a273423384f)
/home/account/www_site/textpattern/lib/txplib_wrapper.php: r2931 (1c1b260a13c67657f1678d72559583bc)
/home/account/www_site/textpattern/publish.php: r3258 (bc931a3406370c1ea4139ef957e95e38)
/home/account/www_site/textpattern/publish/atom.php: r3029 (f8cc6dbfb5a5f2b39ec480589b2d59c3)
/home/account/www_site/textpattern/publish/comment.php: r3266 (815df18aa4d451246ee70dd0502a8484)
/home/account/www_site/textpattern/publish/log.php: r3247 (1c047309f6f13883b29a943d1cddec3a)
/home/account/www_site/textpattern/publish/rss.php: r3029 (c39570953c1bd8347e456d750317b815)
/home/account/www_site/textpattern/publish/search.php: r2812 (29a315e2435b73fe3d3a4d83fe84ba19)
/home/account/www_site/textpattern/publish/taghandlers.php: r3256 (a40dce2989737477b1147d2104bba326)
/home/account/www_site/rpc/index.php: r2998 (682e18cb9bdd6e9442a9ac23db1a591f)
/home/account/www_site/rpc/TXP_RPCServer.php: r3250 (84ff888bf577670c897fdc27ad580c0f)
/home/account/www_site/textpattern/theme/classic/classic.php: r3191 (722c6c7f2c8dbfee5c6cede0af2cd689)
/home/account/www_site/textpattern/update/_to_1.0.0.php: r3047 (cbd20d275bf74184b1112569c2e77f76)
/home/account/www_site/textpattern/update/_to_4.0.2.php: r3047 (4c9f8cd5c16bf19ff191ab35f0354e0f)
/home/account/www_site/textpattern/update/_to_4.0.3.php: r3047 (6a4af33a23caf950c05faca0e8b4c93b)
/home/account/www_site/textpattern/update/_to_4.0.4.php: r3047 (b235e2a27a6e79652ef078f62f73eb21)
/home/account/www_site/textpattern/update/_to_4.0.5.php: r2894 (d17a02f48b79dbe6b3b0cf6eb779aadb)
/home/account/www_site/textpattern/update/_to_4.0.6.php: r3047 (4d7b21635fbf46058cc539a0eec00561)
/home/account/www_site/textpattern/update/_to_4.0.7.php: r3014 (e8ba7dc2892b81ce89b62775e2f5ea17)
/home/account/www_site/textpattern/update/_to_4.0.8.php: r3057 (d699021db8e7c9f7d32f3ad3631caebc)
/home/account/www_site/textpattern/update/_to_4.2.0.php: r3233 (aec6e4aafa98dbafe75506efd7f85816)
/home/account/www_site/textpattern/update/_update.php: r3275 (e9085d568d49ff7910ffd4eb49bbe293)

Offline

#9 2009-11-04 23:55:40

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Forcing index.php for clean urls???

I was looking for ‘Apache modules:’, it usually follows ‘PHP extensions:’, that would show you if mod_rewrite was enabled. But your diagnostics don’t seem to display it (or you forgot to c/p it?).

But I’m beginning to wonder if I misunderstood you:

it’s the GET request that fails and results in a 404 not found error. The clean urls are correctly output as part of the web page syntax to the browser… ie: <a href=“http://my_site.com/journal/7/title-here”>Title Here</a>

the server is looking for my_site_address.com/section/id/title rather than my_site_address.com/index.php/section/id/title

Sorry, it’s a bit confusing to me… my_site_address.com/section/id/title is what clean URLs are supposed to look like if you entered my_site_address.com for Site URL in Preferences (don’t add /index.php!), and /section/id/title for Permanent link mode. So these settings cause 404s?
If I misunderstood, please post your settings for site URL and permanent link mode, and the URLs that return a 404 using those settings.

Offline

#10 2009-11-05 11:17:48

Kelon
Member
Registered: 2009-10-18
Posts: 16

Re: Forcing index.php for clean urls???

Yes.. I’m sorry… awesome how confusing things can be when you’ve no feedback (quizzical looks). I’ve been looking for the Apache modules too… and not finding anything in the usual places in which I find info (that I have access to). Everything that was in the diagnostics I’ve posted for certain. I’m going to play with rewrite today to determine for certain whether it’s working or not (I think it is given evidence in an unrelated subdomain’s directory in the same hosting space).

In my admin – site url: ‘my_site_address.com’ (No index.php) + Permanent link mode switched to clean urls + htaccess in place (as posted above) == doesn’t work. (404’s).

Q: Do all requests need to be internally rewritten to index.php? (I don’t understand what the rewriteConds/rewriteRules in the htaccess are actually doing). I’m presuming they do because it works when I force everything to go there (via the site url dialogue in admin).

I’ve to go out, but then I’ll be on the case.. I know a bit more about rewrite now, I did do a bit of study last night. Thanks for your time Els, apologies for being confusing. Many regards :-)

Last edited by Kelon (2009-11-05 11:27:01)

Offline

#11 2009-11-05 22:14:38

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Forcing index.php for clean urls???

Try the default .htaccess, it looks like yours is missing something:

#DirectoryIndex index.php index.html

#Options +FollowSymLinks
#Options -Indexes

<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]

	RewriteCond %{REQUEST_URI} !=/favicon.ico
	RewriteRule ^(.*) index.php

	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

#php_value register_globals 0

Offline

#12 2009-11-07 21:10:37

Kelon
Member
Registered: 2009-10-18
Posts: 16

Re: Forcing index.php for clean urls???

Hi, yes, I’ve tried that. I’ve just asked my host to help out and they’ve come back with this question….

“Can you tell me what URL this is on? Are you just trying to rewrite all requests to index.php?
Regards,”

Is the answer to the second half of their question ‘yes’?

Thanks….

Offline

Board footer

Powered by FluxBB