Forum Moderators: phranque
I've been spending hours trying to implememt a 301 redirect for 3 of my old pages. I realised they had gaps in their titles, so put up new pages without gaps and need the old pages to redirect to the new.
I have uploaded a .htaccess file to the same folder my index file is in, with the following format of code:
Redirect 301 public_html/Widget Page.html [Mysite.co.uk...]
However the redirect is still not working. My host verified a 301 should work ok.
Does anyone have any tips where i could be going wrong?
Would the original gap be causing an issue?
Does the above code look correct?
Is there another code format i could choose?
Thanks for any assistance in this matter , im stumped...
The "public_html" filepath is not likely to be part of the requested URL, since it is part of a server filepath (not part of a URL).
Therefore, the URL being requested in your example above is likely to be "example.com/Widget%20Page.html" and the URL-path just "/Widget%20Page.html"
I'd recommend that you try the two following variations using mod_alias RedirectMatch. If neither works, then it may be necessary to use a more-powerful module to solve the problem:
RedirectMatch 301 ^/Widget\%20Page\.html$ http://www.example.co.uk/Widgetpage.html
RedirectMatch 301 ^/Widget\ Page\.html$ http://www.example.co.uk/Widgetpage.html
Jim
i tried all the methods you suggested above but with no luck so far. I never realised a redirect could be so problematic.
As a temporary (maybe permanent?) solution, i have just reupped the old pages with the title gaps and will just leave them alongside the new pages. I have changed the text a little between pages so as not to cause any duplicate content issues.
Not the ideal solution i know
Cheers again
Pete
Options +FollowSymLinks -MultiViews
RewriteEngine on
#
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /Widget(\ ¦\%20)Page\.html\ HTTP/
RewriteRule ^Widget.+Page\.html$ http://www.example.co.uk/Widgetpage.html [R=301,L]
Jim