301 Redirects Generator Script for htaccess
Information below was written quite some time ago. My preferred format for 301 redirects is now:
RewriteEngine On
RedirectMatch 301 ^/a.htm(.*)$ http://mydomain.com/newpage-a.html
Lets say you have a large directory that you want to move from say
mydomain.com/oldstructure/directory/files/
to
mydomain.com/more/meaningful/directoryname/
You have hundreds of files in this old directory, and you cannot use a general redirect because there are yet more files in the subdirectories.
You can spend hours manually builing an htaccess file with a couple of hundred lines in it – or you can use this excellent generator script.
This simple German PHP script reads the files in a given directory (and, unfortunately, every directory closely associated with it), gives you a long list of the filenames to tick or leave unchecked as you desire, asks you for the name of the new directory, and then creates a list of 301 redirects like this:
redirect 301 /b/olddirectory/posters/abstract_art.htm http://www.mydomain/posters/main/abstract_art.htm
redirect 301 /b/olddirectory/posters/adult_movie_posters.htm http://www.mydomain/posters/main/adult_movie_posters.htm
redirect 301 /b/olddirectory/posters/african_art_posters.htm http://www.mydomain/posters/main/african_art_posters.htm
redirect 301 /b/olddirectory/posters/alfred_gockel.htm http://www.mydomain/posters/main/alfred_gockel.htm
redirect 301 /b/olddirectory/posters/allied_propaganda_posters.htm
http://www.mydomain/posters/main/allied_propaganda_posters.htm
ff-webdesigner htaccess-301 Redirect Permanent Generator
http://ff-webdesigner.de/webdesign-downloads.html
The script you want is
Download ff.301 generator htaccess redirect as. Zip (5kB)
This is a very rough translation and partial interpretation of the readme file.
FF Web designer htaccess-301 Redirect permanently generator
This Script serves to facilitate the moving of a set of files from one directory or domain to another. It can be also used, in order to operate old homepages parallel to a new.
The problem with a removal is that Google and other search engines have the old addresses of a site for months in the index. Visitors find in search engines your dead pages and are given a 404 not found error. For you as web page operators these visitors are lost. The cleanest way to reroute the lost visitors on the new Domain is so-called 301 Redirect a permanent as of google recommended.
The 301 is an instruction, which is put on in the.htaccess file on the Web server. It looks as follows: Redirect permanently /alte-datei.html http://www.domain.de/neue-datei.html For each individual file an entry must be put on in .htaccess. With extensive homepages can last this for a very long time.
Here the FF Web designer helps 301-Redirect-Permanent-Generator. The generator puts on a Redirect for all selected files and/or listings of its homepage on the indicated new file/the new Domain. The structure of the Hompeage must be thereby under the new address the same, as under the old. Vorraussetzungen for the use are alone PHP and server-laterally sufficient reader-genuine.
Copy the file 301-generator to the root listing of your homepage, and you call it by means of domain.de/301-generator/.
This is the original German text:
Dieses Script dient dazu, den Umzug einer Homepage von einer Domain auf eine andere zu erleichtern. Es kann auch
verwendet werden, um alte Homepages parallel zu einer neuen zu betreiben. Das Problem bei einem Umzug ist, dass
Google und andere Suchmaschinen die alten Adressen einer Homepage noch monatelang im Index haben. Besucher
finden in Suchmachinen Ihre nicht mehr erreichbaren Seiten und erhalten einen Fehler 404 – Seite nicht gefunden. Für
Sie als Webseitenbetreiber sind diese Besucher verloren.
Der sauberste Weg, die verlorenen Besucher auf die neue Domain umzuleiten ist ein sogenannter 301 Redirect Permanent wie von Google empfohlen. Der 301 ist ein Befehl, der in der .htaccess-Datei auf dem Webserver angelegt wird. Er sieht folgendermaßen aus:
Redirect permanent /alte-datei.html http://www.domain.de/neue-datei.html
Für jede einzelne Datei muss ein Eintrag in .htaccess angelegt werden. Bei umfangreichen Homepages kann dies sehr lange dauern. Hier hilft der ff-webdesigner 301-Redirect-Permanent-Generator. Der Generator legt für alle gewählten Dateien und / oder Verzeichnisse ihrer Homepage einen Redirect auf den angegebenen neuen Ordner / die neue Domain an. Die Struktur der Hompeage muss dabei unter der neuen Adresse die gleiche sein, wie unter der alten.
Vorraussetzungen für die Verwendung sind alleine PHP und serverseitig ausreichende Leserechte. Kopieren Sie den Ordner 301-generator ins Rootverzeichnis Ihrer Homepage, und rufen Sie ihn mittels domain.de/301-generator/ auf. Wählen Sie dann durch klicken der Checkboxen die Dateien / Ordner aus, für die eine 301-Weiterleitung erstellt
werden soll.
Dieses Script ist Linkware! Es steht vollkommen frei zur Nutzung, ohne jegliche Gewährleistung. Als einzige Gegenleistung bitte ich um einen Link auf unsere Homepage mit dem Linktext ff-webdesigner.de – Webdesign aus Regensburg & München
Vielen Dank!
Select then through click the check boxes the files/files out, for which a 301-redirect is to be provided.