Page 1 of 1
301 redirects
Posted: Fri Feb 11, 2011 6:02 am
by yellowled
I just turned my static web site into a blog. The static web site used to have some English pages which I'm kind of tired of maintaining. (Sorry, guys.

), but I want to redirect some pages (since they host my templates/ports) to static pages in the blog.
But apparently, it's not that easy in S9y. Usually, I'd just drop a
into my .htaccess, but that doesn't seem to work at all. Any hints on how to do this in S9y's .htaccess?
YL
Re: 301 redirects
Posted: Fri Feb 11, 2011 9:37 am
by Timbalu
As seen in your other post, this might happen while having the PHP problem cgi vs module.
When PHP runs as an Apache module, it is compiled into the Apache code itself. This means, when an Apache process starts, PHP starts along with it. They are intrinsically linked, and PHP depends on Apache to operate. The benefit of this is that Apache tends to run very efficiently, and PHP is part of each Apache process. Furthermore, Apache configuration, particularly when using .htaccess files, can also be used to control PHP functions.
The downside of PHP as a module is also that it is part of Apache. If PHP goes down, so too goes Apache. This makes it more of a security risk, particularly on shared hosting accounts.
PHP as a CGI script means that PHP operates as an independent binary with its own processes. It is separate from Apache and can, therefore, run as another user, rather than Apache’s generic user. This increases security and adds a bit of stability, at the expense of speed.
Aside from being slower, the other downside of PHP as CGI is that users cannot use .htaccess files to control any PHP functionality. For that they must create their own php.ini files.
Find out and try the way over php.ini.
Ian
Re: 301 redirects
Posted: Fri Feb 11, 2011 9:52 am
by yellowled
Timbalu wrote:As seen in your other post, this might happen while having the PHP problem cgi vs module.
I don't think so, since
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
works in the same .htaccess. (Redirecting from
www.yellowled.de to yellowled.de.) However, I have no idea how to apply that syntax scheme to redirecting i.e. s9y.en.html to s9y.html. Guess I need to reread my .htaccess links.
YL
Re: 301 redirects
Posted: Fri Feb 11, 2011 10:14 am
by Timbalu
wie isses damit im IfModule?
Code: Select all
RedirectMatch (.*)\.en\.html$ http://yellowled.de$1.html
Ian
Re: 301 redirects
Posted: Fri Feb 11, 2011 11:36 am
by yellowled
Takes me to 404 view (not a 404 page using .htaccess but template-side using if $view == '404'). The URL bar states
http://yellowled.de/ports.html?url=/ports.en.html.
YL
Re: 301 redirects
Posted: Fri Feb 11, 2011 11:55 am
by Timbalu
You need to get rid of the "?url=/ports.en.html" part, I assume.
There might be a more elegant way, but you could try
Code: Select all
RedirectMatch (.*)\.en\.html(.*)$ http://yellowled.de$1.html
Ian
Re: 301 redirects
Posted: Fri Feb 11, 2011 12:33 pm
by yellowled
Nope, same result. But I think I figured it out:
Code: Select all
RewriteRule (.*)\.en\.html(.*)$ http://yellowled.de/$1.html [R=301,L]
seems to do the trick. It's not perfect, but that's because there are some pages which no longer have an english alternative (like s9y.en.html -> there's no s9y.html now), but I think I can live with that.
YL
Re: 301 redirects
Posted: Fri Feb 11, 2011 1:03 pm
by Timbalu
Good. Adding the [] definitions would have been my next choice...
Perhaps with [PT]
Pass Through: instructs mod_rewrite to pass the rewritten URL back to Apache for further processing.
If it is not ending in the view 404 anymore, you might remove the second (.*) again.
Ian