Log in

View Full Version : Problem with an apostrophe in a URL



wkenny
05-01-2007, 06:03 PM
I added a page to my site with an apostrophe in the url (it was a town name) and updated my sitemap. Google then reported page not found and I realised the apostrophe was the problem. I dropped the apostrophe but am still getting attempted accesses to the old page, presumably from bookmarks or caches.

I tried a permanent redirect by directly editing htaccess but the presence of the apostrophe there brought the site down - attempts to access any page failed.

When I used the host's Control Panel to set up the redirect it converted the apostrophe to unicode, but attempting to access the url with the apostrophe still gave a page not found error.

Is there anyway around this?

djr33
05-01-2007, 08:09 PM
I believe the URI character for an apostrophe is %27, much like %20 for space.
Try, as the address, "yoursite.com/some%27thing.htm".

boogyman
05-01-2007, 08:31 PM
%#27

u need the pound key I believe

Twey
05-01-2007, 08:32 PM
Er, no.

wkenny
05-01-2007, 11:23 PM
Perhaps I should have given the exact example of what is happening.

I created a page based on the actual town name and that page was
site /l'escala_estate_agents_01.htm

Google then started reporting Page not found with this url. If I cut and paste the url into the address bar, the page loaded no problem but clicking in links to the page gave 404 errors. I realised then the apostrophe was a problem and I changed the name to

lescala_estate_agents_01.htm

and I then directly edited the htaccess file as follows:


Redirect permanent l'escala_estate_agents_01.htm
site lescala_estate_agents_01.htm


After making this change every attempt to access the site (any page) brought up a server error (not a 404) and the error log shows e.g.

Tue May 1 06:07:52 2007] [alert] [client 83.52.210.82] public_html/.htaccess: URL to redirect to is missing

I then took out the above redirect command and used the Redirects utility in the host Control Panel

When I typed in the URL (with the apostrophe) of the problem page in the "redirect from" prompt the host showed


site l & # 39 ; (without the spaces) escala_estate_agents_01.htm

When I then looked at htaccess, the host Control Panel utility had written:

RedirectMatch permanent ^/lescala_estate_agents_01.htm$ site lescala_estate_agents_01.htm

Effectively, it seems to ignore the apostrophe and the & # 39 ;

If I now try to access from a link

site l'escala_estate_agents_01.htm

instead of being redirected I get a 404 error.

The problem in itself is not very serious in that no real surfer will ever be accessing the url with the apostrophe, but I am probably losing brownie points with the search engines who have indexed the page with the apostrophe.

Sorry if this is a bit long-winded but I'd love to know a) what's happening and b) what the solution is.

boxxertrumps
05-02-2007, 02:49 AM
u need the pound key I believe
Only in the page source, in urls its fine on its own.

Twey
05-02-2007, 05:29 PM
I think it's because they're on different lines... try:
Redirect permanent /l%27escala_estate_agents_01.htm lescala_estate_agents_01.htm