Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
problem with txp or txd?... some help with redirecting needed...
The background:
I have asked for help in the txd forum but i’m yet to receive a workable suggestion…
We have recently migrated our subdomain http://imca.neme.org to its own domain on http://neme-imca.org
The subdomain used to consist of a static html page on imca.neme.org and a txp powerd content on imca.neme.org/main/
The migrated site only consists of the content which used to reside in the txp powered part.
The neme.org site now consists of 2 txp installations, one of which resides on neme.org/main/
I am now trying to create some redirect rules, alas without success, for the old subdomain addresses
This is what I have
Redirect 301 http://imca.neme.org http://neme-imca.org
RedirectMatch 301 http://imca.neme.org/main/$1(.*) http://neme-imca.org/$1
Currently instead of the urls redirecting to the new site they load pages from neme.org/main.
example: http://imca.neme.org/main/549/sheila-pinkel
htaccess
ErrorDocument 404 http://www.neme.org/oops.php
ErrorDocument 403 http://www.neme.org/oops403.php
RedirectMatch 301 /forum(.*) http://forum.neme.org/$1
SecFilterEngine On
SecFilterSelective "REQUEST_URI" "http://forum.neme.org/post.php" "allow,nolog"
SecFilterSelective REMOTE_ADDR ^xxx.xxx.x.xxx$ nolog,allow
#SecFilterEngine Off
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^neme\.org$
RewriteRule (.*) http://www.neme.org/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php
</IfModule>
#php_value register_globals 0
any help would be appreciated
Last edited by colak (2007-06-30 13:16:32)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: problem with txp or txd?... some help with redirecting needed...
WHere is the .htaccess sitting? In the /main/ directory of the old url? If so, then change this:
RewriteCond %{HTTP_HOST} ^imca\.neme\.org/main/$
RewriteRule (.*) http://neme-imca.org/$1 [R=301,L]
to this:
RewriteCond %{HTTP_HOST} ^newsite\.oldsite\.tld$
RewriteRule (.*) http://newsite.tld/$1 [R=301,L]
Notes: You can’t use $1 in the matching pattern, it’s only used in the replacement pattern as a backreference to the “(…)” parts in the matching pattern. And you can’t use paths when matching the HTTP_HOST, it only contains the domain. An .htaccess only affects the directory (and its subdirectory) that it’s in. So an .htaccess in the /main/ directory will not redirect accesses to the / directory. When you’re matching the request uri (with RedirectMatch or RewriteCond/RewriteRule) and the .htaccess is sitting in a subdirectory of the web-root, those “subdirectory”-parts are stripped before the matching (hence why you don’t have to mention /main/ when matching, if the .htaccess is sitting in the main directory).
Last edited by Sencer (2007-06-24 08:31:09)
Offline
Re: problem with txp or txd?... some help with redirecting needed...
Hi Sencer
thanks for responding to this ..
The above htaccess resides in the root of the domain at www.neme.org
I have recreated the imca and main directories (imca.neme.org/main) and added your code above in a new htaccess file and resulted in a 500…
What I have done now is that I just added a very basic rule in the htaccess residing in imca.neme.org which redirects imca.neme.org to neme-imca.org: Redirect 301 / http://neme-imca.org
I tried manipulating your code and placing it in imca.neme.org/main/ but again… no results…
>Edit… changed the htaccess code in the initial post to reflect what I have now…
Last edited by colak (2007-06-24 10:14:01)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: problem with txp or txd?... some help with redirecting needed...
anyone?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: problem with txp or txd?... some help with redirecting needed...
Maybe I should clarify why I titled this post the way I did…
txd does not serve 404 for mistyped subdomains ie anything.domain.com just loads domain.com unless of course there is a directory called ‘anything’
txp loads the urls from the id so I can have domain.com/main/100 and it would load it regardless of the schema which produces domain.com/main/100/title.
My problem is that I had 2 directories named ‘main’. The one currently resides on neme.org/main and it is where the content of the neme site is residing and used to have another one which resided on imca.neme.org/main which is where the content of the site which is now moved to its own domain on neme-imca.org used to reside.
What currently happens is that the links from the ‘imca’ subdomain which looked something like imca.neme.org/main/100/title are ‘parsed’ by txd which ‘ignores’ the imca subdomain causing the equivalent url to load from the neme.org/main install.
so, instead of getting a 404 what i wrongly get when I type imca.neme.org/main/100/title is the article from neme.org/main/100/.
I hope that the above explains problem more clearly.
Last edited by colak (2007-06-26 10:09:37)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2007-06-27 02:37:52
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: problem with txp or txd?... some help with redirecting needed...
I’m a bit confused with all the changes. Would you please post your current .htaccess in full (no changes) and where it is located?
Offline
Re: problem with txp or txd?... some help with redirecting needed...
What about creating an alias of imca.neme.org for the domain neme-imca.org? Then, put something like this in the .htaccess for neme-imca.org:
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /relative/web/path/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{HTTP_HOST} ^(www\.)?imca\.neme\.org$ [NC]
RewriteRule ^(.*)$ http://neme-imca.org/$1 [R=301,L]
RewriteRule ^(.*) index.php
</IfModule>
And that should permentantly redirect (301) to the neme-imca.org domain.
Offline
Re: problem with txp or txd?... some help with redirecting needed...
Thank you all for your help
Mary wrote:
I’m a bit confused with all the changes. Would you please post your current .htaccess in full (no changes) and where it is located?
This is the htaccess file which resides in neme.org
ErrorDocument 404 http://www.neme.org/oops.php
ErrorDocument 403 http://www.neme.org/oops403.php
RedirectMatch 301 /forum(.*) http://forum.neme.org/$1
SecFilterEngine On
SecFilterSelective "REQUEST_URI" "http://forum.neme.org/post.php" "allow,nolog"
SecFilterSelective REMOTE_ADDR ^213.7.105.219$ nolog,allow
#SecFilterEngine Off
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^neme\.org$
RewriteRule (.*) http://www.neme.org/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php
</IfModule>
#php_value register_globals 0
this resides in imca.neme.org
Redirect 301 / http://neme-imca.org/
christopher.. Your rule would redirect urls from imca.neme.org/main/100/title
to neme-imca.org/main/100/title
which would result in a 404 in the neme-imca.org site as the urls now reside in the root of the site…
What I need is a rule which redirects urls from imca.neme.org/main/100/title
to neme-imca.org/100/title
Last edited by colak (2007-06-27 06:56:59)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: problem with txp or txd?... some help with redirecting needed...
anyone?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#10 2007-06-28 20:12:38
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: problem with txp or txd?... some help with redirecting needed...
You could try this in your main domain’s .htaccess, just under your rules for forcing ‘www’ in your URL:
RewriteCond %{HTTP_HOST} ^(www\.)?imca\.neme\.org [NC]
RewriteRule ^/main/(.*)?$ http://neme-imca.org/$1 [R=301,L]
If I’m thinking straight, that should do what you want, and you can get rid of the .htaccess in your old subdomain.
Offline
Re: problem with txp or txd?... some help with redirecting needed...
hi mary… the rule returns a 500:(
I also tried
RewriteCond %{HTTP_HOST} !imca.neme.org$
RewriteRule (.*) http://neme-imca.org/$1 [R=301,L]
which failed to redirect.. Mamash over at the txd forum suggested to do a ‘standard’ redirect from imca.neme.org/… to neme-imca.org/… and then have a rule within neme-imca.org to redirect from /main to root…
Sounded good and simple but that did not work either…
My problem is that no 404s are served on the old addresses so things will get confusing both with the visitors and google…
Last edited by colak (2007-06-29 07:09:10)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#12 2007-06-30 02:42:45
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: problem with txp or txd?... some help with redirecting needed...
I also tried… which failed to redirect.
That makes sense, your condition reads as “if the request is not for imca.neme.org…”
Try adding this:
RewriteLog "/full/path/to/rewrite.log" #-- an empty text file somewhere on your server
RewriteLogLevel 9
Then do a couple requests for an old URL that should redirect. Then remove (or comment out) those lines leaving them there isn’t a good idea), and look at the rewrite log to see what’s happening.
Last edited by Mary (2007-06-30 02:43:20)
Offline