[TYPO3-UG Dutch] 301 redirect

HocomAdvies [ Wiechert Hooghwinkel ] info at hocom-advies.nl
Fri Jan 21 10:57:18 CET 2011


Bedankt voor jullie bijdragen. Volgens mij ben ik er nu uit.
Naast de opzet zoals die van Jacco, is dit een oplossing die werkt voor het 301 redirecten van zogenaamde "dynamic urls" van de oude website, die in google geindexeerd zijn, naar vervangende pagina's in de typo3 site:

Een dynamic url is bijvoorbeeld een link zoals deze:
http://www.fietsemderin.nl/?actie=agenda

#redirect voor /?actie=agenda
RewriteCond %{QUERY_STRING} actie=agenda$   (alles achter
RewriteRule ^$ /agenda_nieuw? [R=301,L] 

Maar ook bijvoorbeeld een wat uitgebreidere dynamic url:
http://www.haaldiefietserweeruit.nl/?id=fotoboek&map=voorbeelden&foto=35

#de redirect voor deze url:
RewriteCond %{QUERY_STRING} id=fotoboek&map=voorbeelden&foto=([0-9]+)$ 
RewriteRule ^$ /fotoboek_nieuw? [R=301,L] 

Door gebruik te maken van zogenaamde "Regular Expressions" is een oplossing zoals bovenstaande mogelijk. Het is wel even puzzelen:) 
Pas dan wel op met testen, want een appache 500 server error, of internal server error, of een oneindige loop, liggen op de loer. Dus stap voor stap uittesten zodat je nog terug kan naar de werkende .htaccess. 

Met vriendelijke groeten,
HocomAdvies
Wiechert Hooghwinkel
www.hocom-advies.nl
0343-574600
info at hocom-advies.nl




Op 18 jan 2011, om 13:20 heeft HocomAdvies [ Wiechert Hooghwinkel ] het volgende geschreven:

> Jacco,
> 
> Ja dat ziet er mooi uit, zo ver was ik ook al wel gekomen, maar het is nog niet het antwoord op mijn vraag? 
> 
> Voor de volledigheid de actieve inhoud van de .htaccess die ik nu heb:
> 
> ### Begin: Rewrite stuff ###
> 
> # Enable URL rewriting
> RewriteEngine On
> 
> 
> #redirects voor oude in google index aanwezige pagina's
> #die staan hier en niet aan het einde van de /htaccess omdat het dan niet werkte
> 
> #redirect voor /?actie=aanbieding_nieuw
> RewriteCond %{REQUEST_URI} ^([^&]*&)*(/?)=|actie=(aanbieding_nieuw)&? [NC] 
> RewriteRule .* /aanbieding [L,R=301]
> 
> #redirect voor /?actie=bedrijven
> RewriteCond %{REQUEST_URI} ^([^&]*&)*(/?)=|actie=(bedrijven)&? [NC] 
> RewriteRule .* /bedrijven [L,R=301]
> 
> #redirect voor /?actie=contact
> RewriteCond %{REQUEST_URI} ^([^&]*&)*(/?)=|actie=(contact)&? [NC] 
> RewriteRule .* http://www.menes.nl/contact [L,R=301]
> 
> #redirect voor /?actie=werkwijze
> RewriteCond %{REQUEST_URI} ^([^&]*&)*(/?)=|actie=(werkwijze)&? [NC] 
> RewriteRule .* /werkwijze [L,R=301]
> 
> #redirect voor /?actie=fotohoek
> RewriteCond %{REQUEST_URI} ^([^&]*&)*(/?)=|actie=(fotohoek)&? [NC] 
> RewriteRule .* /voorbeelden [L,R=301]
> 
> #redirect voor /?actie=fotoboek
> RewriteCond %{REQUEST_URI} ^([^&]*&)*(/?)=|actie=(fotoboek)&? [NC] 
> RewriteRule .* /voorbeelden [L,R=301]
> 
> #redirect voor /?actie=fotoboek&voorbeelden=tafels&foto=1 
> RewriteCond %{REQUEST_URI} ^/([^&]*&)*(/?)=|actie=(fotoboek&map=voorbeelden&foto=1)&? [NC] 
> RewriteRule .* /voorbeelden [L,R=301]
> 
> #redirect voor /aanbieding.php
> RewriteCond %{REQUEST_URI} ^/aanbieding.php/$
> RewriteRule .* /aanbieding [L,R=301]
> RewriteCond %{REQUEST_URI} ^/aanbieding.php$
> RewriteRule .* /aanbieding [L,R=301]
> 
> ### einde redirects vanuit google ####
> 
> 
> #######
> #redirect van url zonder www naar met www om duplicated contet te voorkomen
> RewriteCond %{HTTP_HOST} ^desite.nl
> RewriteRule (.*) http://www.desite.nl/$1 [R=301,L]
> ######
> 
> 
> # If you use the RealUrl extension, then you'll have to enable the next line.
> # You will have to change this path if your TYPO3 installation is located
> # in a subdirectory of the website root.
> # 
> # If you place this in httpd.conf, you cannot use this directive in any case!
> #RewriteBase /
> 
> # Stop rewrite processing if we are in the typo3/ directory
> # For httpd.conf, use this line instead of the next one:
> # RewriteRule ^/TYPO3root/(typo3/|t3lib/|tslib/|fileadmin/|typo3conf/|typo3temp/|uploads/|showpic\.php|favicon\.ico) - [L]
> RewriteRule ^(typo3/|t3lib/|tslib/|fileadmin/|typo3conf/|typo3temp/|uploads/|showpic\.php|favicon\.ico) - [L]
> 
> # Redirect http://mysite/typo3 to http://mysite/typo3/index_re.php
> # and stop the rewrite processing
> # For httpd.conf, use this line instead of the next one:
> # RewriteRule ^/TYPO3root/typo3$ /TYPO3root/typo3/index.php [L]
> RewriteRule ^typo3$ typo3/index_re.php [L]
> 
> # If the file/symlink/directory does not exist => Redirect to index.php
> # Important note: If you copy/paste this into httpd.conf instead
> # of .htaccess you will need to add '%{DOCUMENT_ROOT}' left to each
> # '%{REQUEST_FILENAME}' part.
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-l
> 
> # Main URL rewriting.
> 
> # If you use Windows and SimulateStaticDocuments do not work, try adding a
> # slash (/) right before 'index.php' below.
> 
> # The example shows how to rewrite only *.html and *.pdf files to index.php
> # This may be helpful when using an extension that can generate PDF files
> # on the fly.
> # Example: RewriteRule .*\.(html|pdf)$ index.php [L]
> 
> # For httpd.conf, use this line instead of the next one that has no '#':
> # RewriteRule .* /TYPO3root/index.php [L]
> 
> # For use with the RealUrl extension, you might need to remove the
> # RewriteBase directive somewhere above and use this line instead of the
> # next one:
> # RewriteRule .* /index.php [L]
> 
> RewriteRule .* index.php [L]
> 
> ### End: Rewrite stuff ###
> 
> # Add your own rules here
> 
> 
> 
> Met vriendelijke groeten,
> Wiechert Hooghwinkel
> 
> 
> Op 18 jan 2011, om 12:15 heeft Jacco van der Post het volgende geschreven:
> 
>> Vooruit, hier een goede .htaccess :)
>> 
>> 
>> 
>> 
>> php_value memory_limit 128M
>> php_value post_max_size 128M
>> php_value upload_max_filesize 128M
>> 
>> # *************************************
>> # REALURL
>> # *************************************
>> RewriteEngine On
>> RewriteRule ^typo3$ - [L]
>> RewriteRule ^typo3/.*$ - [L]
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteCond %{REQUEST_FILENAME} !-d
>> RewriteCond %{REQUEST_FILENAME} !-l
>> RewriteRule .* index.php
>> 
>> 
>> # *************************************
>> # Handle compressed .js and .css files correctly TYPO3 4.4 +
>> # *************************************
>> <FilesMatch "\.js\.gzip$">
>> AddType "text/javascript" .gzip
>> </FilesMatch>
>> <FilesMatch "\.css\.gzip$">
>> AddType "text/css" .gzip
>> </FilesMatch>
>> AddEncoding gzip .gzip
>> 
>> 
>> # *************************************
>> #   301 redirect oude links tbv SEO
>> # *************************************
>> 
>> 
>> RewriteCond %{REQUEST_URI} ^/bla/$
>> RewriteRule .* /blanieuw/ [L,R=301]
>> RewriteCond %{REQUEST_URI} ^/bla$
>> RewriteRule .* /blanieuw/ [L,R=301]
>> 
>> RewriteCond %{REQUEST_URI} ^/bliep/$
>> RewriteRule .* /bliepnieuw/ [L,R=301]
>> RewriteCond %{REQUEST_URI} ^/bliep$
>> RewriteRule .* /bliepnieuw/ [L,R=301]
>> 
>> #etc etc etc
>> 
>> 
>> 
>> -- 
>> Met vriendelijke groet
>> Kind Regards
>> 
>> Jacco van der Post
>> Certified TYPO3 Integrator
>> 
>> Tel +31 (0)24 3602100
>> 
>> www.id-internetservices.com
>> _______________________________________________
>> TYPO3-UG-Dutch mailing list
>> TYPO3-UG-Dutch at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-ug-dutch
> 
> _______________________________________________
> TYPO3-UG-Dutch mailing list
> TYPO3-UG-Dutch at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-ug-dutch



More information about the TYPO3-UG-Dutch mailing list