Changing hosting provider #4

It has been three days ago since I switched my site to the new server. Little by little the visitors switched as DNS servers synchronised all over the world. And little by little I noticed some problems on my site.

These problems were related the two changes I made in the set-up of my site: I moved my photo gallery from its subdirectory /photos to its own sub-domain and I changed all URLs of the individual archives from entry_name.html to entry_name/index.shtml.

The first change broke all links to the photos (and what is a photo gallery without photos?) which I corrected by editing all 51 entries. Furthermore I still have to create a symbolic link to some files from my main site, like robots.txt.

The second change broke nothing on my site, but some links to my pages on other sites (Google!) broke terribly. Therefore I decided to us my good friend mod_rewrite to serve people the right page. All I had to do was to create a rule to redirect requests for /archives/yyyy/mm/entry_name.html to /archives/yyyy/mm/entry_name/. So I created the following rule:

# Redirect old URI's to future-proof directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (archives/[0-9]{4}/[0-9]{2}/.*).html$ $1/ [R=permanent]

This did a good job, except for two problems: it also redirected the URI of my monthly archives to archives/yyyy/mm/index/ and it added a slash in front of the URI, so the URL would look like… The first problem was easily solved:

# Redirect old URI's to future-proof directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !index.s?html$
RewriteRule (archives/[0-9]{4}/[0-9]{2}/.*).html$ $1/ [R=permanent]

For the second problem I am still looking for a solution.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.