Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Use custom url rewriting and don't let TXP throw 404
I have urls like this:
- moiki/?type=ceramics
- moiki/?type=granit
..and i want to “rewrite” this urls:
- moiki/type/ceramics
- moiki/type/granit
I tried to add this to .htaccess:
RewriteRule ^moiki/type/(.*) moiki/?type=$1 [L]
This works for dummy test – here is the output for print_r($_SERVER)
placed in index.php
But the problem is, as I see, that TXP treats this url lik “section ‘moiki’, then search url with title ‘type’ and some mis-understandable ‘/ceramics/’”.
Is there any way to make TXP parse this url as it is entered in addres like moiki/?type=granit
, not moiki/type/ceramics
P.S. “moiki” is translated from russian as “kitchen sinks”
My current .htaccess file:
#DirectoryIndex index.php index.html
Options +FollowSymLinks
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /relative/web/path/
#moiki/?type=steel
RewriteRule ^moiki/type/(.*) moiki/?type=$1
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
Last edited by the_ghost (2011-02-12 00:23:28)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#2 2011-02-12 01:12:00
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Use custom url rewriting and don't let TXP throw 404
Can’t you do that with gbp_permanent_links?
Offline
Re: Use custom url rewriting and don't let TXP throw 404
Els wrote:
Can’t you do that with gbp_permanent_links?
This plugin is really misty for me. Leak of docs doesn’t let to understand how to make this :)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Use custom url rewriting and don't let TXP throw 404
I’m not sure I followed exactly what you wanted to do, but would it help to tell txp explicitly how to process your redirect, e.g.
RewriteRule ^(moiki)/(type)/(.*) index.php?s=$1&$2=$3 [L]
or similar, e.g. index.php?s=$1&c=$3
.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Use custom url rewriting and don't let TXP throw 404
Thanks jakob! I just was thinking over something like your advice, but didn’t have enogh barin power this week :) Thanks a lot!
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline