Forum Moderators: phranque
Typically what has happened to date is these pages are altered by the user's browser to the following: domain/directory/word1%20word2.htm
It was recently suggested to me that a space in the page name was something I needed to take action on, so I have, in this manner.
Renamed each such page to domain/directory/word1-word2.htm
Loaded pages via ftp, but left old pages up as well, so directory now contains:
domain/directory/word1%20word2.htm AND
domain/directory/word1-word2.htm
for each such page. Pages are identical except for the page name.
Applied a Permanent Redirect so that requests for:
domain/directory/word1 word2.htm
GO TO
domain/directory/word1-word2.htm
That dinna work, so I switched the 301 st that requests for:
domain/directory/word1%20word2.htm
GO TO
domain/directory/word1-word2.htm
That dinna work either.
So, still being a confuzzled owner and wearer of a Near Total Newbie button, I don't know what to do next. I don't want, or need the pages to be duplicated except for title, but I don't know what to do next to fix this mess.
Any workable solution would be greatly appreciated
You could try
RedirectMatch /directory/word1\ word2\.html http://example.com/directory/word1-word2.html
A similar approach might work using mod_rewrite instead of mod_alias.
In either case, you may be able to make use of backreferences to simplify the job of redirecting a large number of pages:
RedirectMatch /directory/(^\ )*\ (.*) http://example.com/directory/$1-$2
HTH,
Jim