Thanks for the info, I was wondering how you could go about doing this. Looking at all the code though, I think it would have been a lot easier to just upgrade the site than do all that. But I guess you don’t have to worry about it in the future now.
Hi Josh,
Looking at all the code though, I think it would have been a lot easier to just upgrade the site than do all that. But I guess you don’t have to worry about it in the future now.
You’re probably right, but I welcomed the opportunity to learn more about .htaccess files. My primary objective was to have a permanent solution that, as you pointed out, won’t require any additional work in the future.
Uwe
Even if your ingenious solution were more work than upgrading WordPress once, it’s not more work than upgrading WordPress with each new release, and doing so until the end of time. This summer alone there have been four security releases of WordPress.
A useful feature would be a command-line utility to put WordPress in read-only mode. Although it probably couldn’t protect against all cross-site scripting vulnerabilities (some of which could conceivably appear in PHP itself), there should at least be a way to protect WordPress from corrupting its own files and database.
Thanks for this post! Six years passed but it’s still useful. :) Just wanted to share my two cents.
I used wget with:
--mirror --convert-links --adjust-extension --page-requisites --no-parent --no-host-directories
so I got the correct extensions but still had question marks in my filenames. To get redirection working, this is what I used in my .htaccess:
DirectoryIndex index.html
RewriteEngine on
RewriteBase /
# index.html, feeds
RewriteCond %{QUERY_STRING} ^feed=(.+)$
RewriteRule ^(index\.html|)$ index.html\%3Ffeed=%1? [NE,R,L]
# index.html, with parameters
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^(index\.html|)$ index.html\%3F%1.html? [NE,R,L]
I didn’t care about trackbacks or xmlrpc, and I wanted the new URLs to be visible to the user (hence the R). If your blog is under a subfolder you can use a different base or replace “index.html\%3F%1.html” with “/blog/index.html\%3F%1.html”, for example.
The NE is to handle the question marks in the filenames. You can avoid them by using
--restrict-file-names=windows
with wget.