Results 1 to 7 of 7

Thread: Problem with an apostrophe in a URL

  1. #1
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Problem with an apostrophe in a URL

    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?
    Cheers
    Billy

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I believe the URI character for an apostrophe is %27, much like %20 for space.
    Try, as the address, "yoursite.com/some%27thing.htm".
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    &#37;#27

    u need the pound key I believe

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Er, no.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    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.
    Cheers
    Billy

  6. #6
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by boogyman View Post
    u need the pound key I believe
    Only in the page source, in urls its fine on its own.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I think it's because they're on different lines... try:
    Code:
    Redirect permanent /l&#37;27escala_estate_agents_01.htm lescala_estate_agents_01.htm
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •