Results 1 to 3 of 3

Thread: Mod Rewrite, to Remove Spaces

  1. #1
    Gimme Fries with that!
    Join Date
    Aug 2004
    Posts
    1,469

    Mod Rewrite, to Remove Spaces

    I have a page, here is a basic example, That I am using mod rewrite to get rid of most the crap in the url, and make it spiderable for my own movie search engine.

    http://www.moviesonline.ca/gallery_d...%20of%20Chucky

    Using mod rewrite i made it into this

    http://www.moviesonline.ca/_Seed%20of%20Chucky.htm

    Now my dilemna is HOW do I later my mod-rewrite to get rid of the %20 and make it a DASH instead ( - )

    the line in my htaccess is

    Code:
    RewriteRule _(.*)\.htm$ /gallery_details_movie.php?movie=$1
    Thanks Guys! New to mod rewrite getting the hang of er with some help.

  2. #2
    Registered Alien
    Join Date
    Aug 2004
    Location
    .au/.sg
    Posts
    58
    The RewriteRule will work for dash (-) as well. What you need to do is modify the php scripting part to return the %20 as dash (-).

  3. #3
    4x4
    Join Date
    Oct 2004
    Posts
    1,043
    mod_rewrite doesn't make the URLs your PHP script does.. or whatever you use to make the links.

    I don't like having spaces in the URL at all. Why not remove spaces and replace them with - then simply have your gallery_details_movie.php file replace - with spaces. I know it's ultimately the same thing, but I prefer - in the address rather than %20

    I have a clean_title() php function I wrote for converting certain characters into nothing or into -'s if you want.. It can get tricky depending on the titles of the movies you review when looking them up by the title, that's why I reccomend using something like this for the mod_rewrite URL.

    # would represent the row ID of the movie Seed of Chucky in the mysql database, an the gallery_details_movie.php can lookup what movie to get info about based on the unique ID # rather than having to re-parse the movie title, and lookup based on the string which could have been translated back incorrectly. #'s are just so much easier to deal with

    http://www.moviesonline.ca/n#-Seed-of-Chucky.htm

Similar Threads

  1. Mod Rewrite Assistance
    By Emancipator in forum Website Programming & Databases
    Replies: 10
    Last Post: 08-16-2004, 04:15 PM
  2. Rewrite conditions being ignored
    By mobilebadboy in forum Website Programming & Databases
    Replies: 3
    Last Post: 06-28-2004, 12:55 PM
  3. Getting Google to remove a site?
    By r2d2 in forum Search Engine Optimization
    Replies: 5
    Last Post: 05-03-2004, 07:46 AM
  4. URL's with spaces in variable values
    By chromate in forum Search Engine Optimization
    Replies: 8
    Last Post: 10-16-2003, 04:04 PM

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
  •