Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Good afternoon all!

Today I'm trying to use pretty urls and htaccess to do some rewritting
I have a the site configured like this:

portalsite.com/sd/PRETTYURLOFARTIST

And i'm trying to use mod_rewrite to make "artist.portalsite.com" show the contents of "portalsite.com/sd/PRETTYURLOFARTIST"

I already can make the redirect using:
Code: Select all
RewriteCond %{HTTP_HOST} ^(.*)\.portalsite\.com$
RewriteRule ^(.*)$ /sd/index.php?fname=%1 [L]


The thing is, that the fname "function" (or whatever it is) is making a visible redirect to "artist.portalsite.com/sd/PRETTYURLOFARTIST" instead of just letting alone "artist.portalsite.com".

There is any way i could make this invisible redirect happen without having to rely on mod_proxy?
Hi,

Every page in Couch has its canonical URL and if you try to access it using any other URL it will redirect to the canonical one. I think this possibly could be the reason for the behaviour you mentioned.
KK wrote: Hi,

Every page in Couch has its canonical URL and if you try to access it using any other URL it will redirect to the canonical one. I think this possibly could be the reason for the behaviour you mentioned.


I disabled every other redirect from the htaccess in order avoid falling into double redirects.
If i call the "index.php?fname=nameoftheurl" the kfunction (i think that file is) calls some visible redirect to the new url showing the same contents. I just can't track where is that redirect and change it in order to make it invisible (not R in the htaccess).
I guess i could use the canonical url (i guess you're talking about the "index.php?p=X" type of url) but i would need some kind of function to undo the prettyurl stuff (having the prettyurl link convert it into the ugly one) in order to grab the data.

I'm pretty confused >.<
The 'canonical' URLs patterns are in-built into Couch and are not taken from the .htaccess file.

To disable Couch's default behaviour of redirecting to the canonical URLs, you can do the following (will need the current 1.4.5 version) -
make the last PHP statement of the involved template as follows
<?php COUCH::invoke( K_IGNORE_CANONICAL_URL ); ?>

That said, I wonder if you have taken a look at http://www.couchcms.com/docs/concepts/pretty-urls.html ? The default prettyURLs used by Couch usually suffice for most purposes.

Hope it helps.
KK wrote: The 'canonical' URLs patterns are in-built into Couch and are not taken from the .htaccess file.

To disable Couch's default behaviour of redirecting to the canonical URLs, you can do the following (will need the current 1.4.5 version) -
make the last PHP statement of the involved template as follows
<?php COUCH::invoke( K_IGNORE_CANONICAL_URL ); ?>

That said, I wonder if you have taken a look at http://www.couchcms.com/docs/concepts/pretty-urls.html ? The default prettyURLs used by Couch usually suffice for most purposes.

Hope it helps.

Yup, i did read all the part of the prettyurl.
On a second read i found out that due to the way i'm rewritting the links myself, i don't even need them and that was the visible redirect i was getting.

So, disabling prettyurl in the config.php and using the same code:

Code: Select all
RewriteCond %{HTTP_HOST} ^(.*)\.portalsite\.com$
RewriteRule ^(.*)$ /sd/index.php?fname=%1 [L]


I get a perfectly nice artist subdomain for my portal.

Thanks a lot KK for your patience
5 posts Page 1 of 1