Page 1 of 1

htaccess redirect

Posted: Sat Sep 27, 2008 2:17 pm
by ameo
hi there,
i was trying to redirect my old urls to the new ones but 301 redirect isn't working for some reason

i tried

Code: Select all

redirect 301 /articles.php?article_id=24 http://www.domain.com/archives/2-post.html
but didn't work

it worked before but i don't know why not this time

thanks [/code]

Posted: Sat Sep 27, 2008 2:21 pm
by ameo
another question please!
how to create pages? not posts

is there away to make these or using the entry method and disabling comments and trackbacks?

thanks

Posted: Sat Sep 27, 2008 3:35 pm
by ameo
update:

Code: Select all

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 
how to make that redirect works? coz it's not working right now

Posted: Sun Sep 28, 2008 12:45 pm
by garvinhicking
Hi!

Does your server support mod_rewrite? The rule should work actually, I think...

You can create pages with the "Static Page" plugin.

Regards,
Garvin

Posted: Mon Sep 29, 2008 4:09 am
by ameo
garvinhicking wrote:Hi!

Does your server support mod_rewrite? The rule should work actually, I think...

You can create pages with the "Static Page" plugin.

Regards,
Garvin
yes mod_rewrite is enabled, it's really weird why 301 redirect doesn't work with s9y!
any idea about the best working redirecting way that should work?

thanks

Posted: Mon Sep 29, 2008 1:28 pm
by garvinhicking
Hi!

You did put your custom code as the very first in the .htaccess file, right?

Try to add use [L] as an option for the redirect, so that once your custom rule hits the redirect will not check the other s9y rules.

Regards
Garvin

Posted: Mon Sep 29, 2008 4:26 pm
by ameo
i don't know .. still for some reason NOT WORKING!

have you tried it with your .htaccess?
if it worked with can you give me the exact code you've used? might be something wrong i'm doing yet i doubt that!

thanks

Posted: Tue Sep 30, 2008 5:50 pm
by garvinhicking
Hi!

Code: Select all

RewriteEngine on
rewritecond %{HTTP_HOST} ^domain.com [NC]
rewriterule ^(.*)$ http://www.domain.com/$1 [R=301,NC,L]
should work, but I cannot currently test it on my server. You used some lowercase strings, maybe that's the trouble.

Regards,
Garvin

Posted: Wed Oct 01, 2008 5:25 am
by ameo
still not working, tried it in both positions before and after s9y stuff and in both didn't work

Posted: Wed Oct 01, 2008 11:47 am
by garvinhicking
Hi!

What is your actual domain, what is your actuall .htaccess content right now?

Regards,
Garvin

Posted: Wed Oct 01, 2008 2:32 pm
by ameo
garvinhicking wrote:Hi!

What is your actual domain, what is your actuall .htaccess content right now?

Regards,
Garvin

Code: Select all

# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php

RewriteEngine On
RewriteBase /
RewriteRule ^((archives/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.html)/?) index.php?/$1 [NC,L,QSA]
RewriteRule ^(authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [NC,L,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA]
RewriteRule ^archive/? index.php?url=/archive [L,QSA]
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA]
RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
RewriteRule ^comments/(.*) index.php?url=/comments/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]

<Files *.tpl.php>
    deny from all
</Files>

<Files *.tpl>
    deny from all
</Files>

<Files *.sql>
    deny from all
</Files>

<Files *.inc.php>
    deny from all
</Files>

<Files *.db>
    deny from all
</Files>

# END s9y
Domain http://www.bluecirclet.com/

Example for what i wanna redirect :

Code: Select all

redirect 301 /articles.php?article_id=31 http://www.bluecirclet.com/archives/1-Body-Art.html

Posted: Wed Oct 01, 2008 2:35 pm
by garvinhicking
Hi!

So did you try this htaccess:

Code: Select all

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^bluecirclet.com [NC]
RewriteRule ^(.*)$ http://www.bluecirclet.com/$1 [R=301,NC,L]

# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php

RewriteEngine On
RewriteBase /
RewriteRule ^((archives/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.html)/?) index.php?/$1 [NC,L,QSA]
RewriteRule ^(authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [NC,L,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA]
RewriteRule ^archive/? index.php?url=/archive [L,QSA]
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA]
RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
RewriteRule ^comments/(.*) index.php?url=/comments/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]

<Files *.tpl.php>
    deny from all
</Files>

<Files *.tpl>
    deny from all
</Files>

<Files *.sql>
    deny from all
</Files>

<Files *.inc.php>
    deny from all
</Files>

<Files *.db>
    deny from all
</Files>

# END s9y
?

Regards,
Garvin

Posted: Wed Oct 01, 2008 2:43 pm
by ameo
no i didn't try that and it works :)

how can i added rules ?
to direct

/articles.php?article_id=31 [to] http://www.bluecirclet.com/archives/1-Body-Art.html

?

Posted: Wed Oct 01, 2008 2:48 pm
by garvinhicking
Hi!
ameo wrote:no i didn't try that and it works :)
But that's what I wrote from the beginning. :-)
how can i added rules ?
to direct
Try:

Code: Select all

RewriteCond %{QUERY_STRING}  article_id=31
RewriteRule ^.* http://www.bluecirclet.com/archives/1-Body-Art.html [R,L]
at the top, before #BEGIN s9y, after the current RewriteRule.

regards,
garvin

Posted: Wed Oct 01, 2008 2:57 pm
by ameo
garvinhicking wrote:
But that's what I wrote from the beginning. :-)

regards,
garvin
Really? i guess i did something wrong then :D

btw the code you gave me worked but it redirected me to

Code: Select all

http://www.bluecirclet.com/archives/1-Body-Art.html?article_id=31