301-Redirects für s9y-URLs

Hier können Probleme und alles andere in Deutscher Sprache gelöst werden.
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

301-Redirects für s9y-URLs

Post by yellowled »

Ich ziehe gerade eine Seite von s9y auf ein CMS um. Dabei sind einige wenige eingehende Links vorhanden, die über 301-Redirects aus SEO-Gründen „erhalten“ bleiben sollen. Normalerweise trivial:

Code: Select all

RewriteRule foo.html /bar/ [R=301,L]
Dummerweise werden in der existierenden s9y-Installation keine lesbaren URLs genutzt, d.h. einige der umzuleitenden URLs sehen so aus:

Code: Select all

index.php?/foo/bar.html
und die dazu passenden Rewrite-Regeln, die etwa so aussehen,

Code: Select all

RewriteRule index.php?/foo/bar.html /foo/bar/ [R=301,L]
funktionieren nicht™. Hat jemand einen Schimmer, warum nicht? Liegt es möglicherweise daran, dass das neue CMS ebenfalls eine index.php verwendet?

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 301-Redirects für s9y-URLs

Post by garvinhicking »

Hi!

Du musst dafür RewriteCond und QUERY_STRING (oder so) abprüfen. Google das mal. :)

LG,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: 301-Redirects für s9y-URLs

Post by yellowled »

garvinhicking wrote:Du musst dafür RewriteCond und QUERY_STRING (oder so) abprüfen.
Sehr genial, danke. Falls das mal jemand braucht:

Code: Select all

RewriteCond %{QUERY_STRING} ^/altes/ziel.html$
RewriteRule ^index.php$ /neue/url/? [R=301,L]
YL
Post Reply