www.webdeveloper.com
Results 1 to 5 of 5

Thread: SEO URL Rewriting Using .htaccess

  1. #1
    Join Date
    Dec 2005
    Posts
    2,984

    SEO URL Rewriting Using .htaccess

    This is my dynamic URL

    http://www.memoriesforever.ca/limous...event=weddings

    I placed the below text in my .htaccess file in my root directory
    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule limousines/(.*)/(.*)/$ /limousines.php?$1=$2
    pointed my links to

    http://www.memoriesforever.ca/limousines/event/weddings

    and got the base limousines.php page with all styles and graphic removed (I am assuming this is because the page was looking for the stylesheet in the wrong directory).

    How do I do the URL rewriting stuff the right way? I'm brand new to it and at a total loss.
    I've switched careers...
    I'm NO LONGER a scientist,
    but now a web developer...
    awesome.

  2. #2
    Join Date
    May 2006
    Location
    Prague, Czech Republic
    Posts
    66
    Hello.
    I think there are two problems, the first is that a dot (.) will match everything, including / so perhaps replace it with something like [a-z0-9] which will mathc any lowercase letter or number.
    The second possible problem is that a * will match zero or more times, so it will match if there is nothing specified, e.g. limousines/// so maybe replace it with a + which will match one or more times.

  3. #3
    Join Date
    Mar 2008
    Location
    INDIA
    Posts
    20
    Is there any link/tutorial on how to create MOD-REWRITE urls using PHP.

    I have used copy-paste htaaccess from tutorial websites , but I am really keen to understand how to write my own customized MOD-REWRITE rules.
    Best SEO Company offering Search Engine Optimization Services to clients worldwide from USA, UK, Canada and Australia.

  4. #4
    Join Date
    May 2006
    Location
    Prague, Czech Republic
    Posts
    66
    There's a great beginners' guide here:

    http://www.yourhtmlsource.com/sitema...rewriting.html

    And a cheat sheet here:

    http://www.ilovejackdaniels.com/chea...e-cheat-sheet/

    The yourhtmlsource.com guide is really great and should be everything you need.

  5. #5
    Join Date
    Jun 2011
    Posts
    1
    Quote Originally Posted by aj_nsc View Post
    This is my dynamic URL

    http://www.memoriesforever.ca/limous...event=weddings

    I placed the below text in my .htaccess file in my root directory
    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule limousines/(.*)/(.*)/$ /limousines.php?$1=$2
    pointed my links to

    http://www.memoriesforever.ca/limousines/event/weddings

    and got the base limousines.php page with all styles and graphic removed (I am assuming this is because the page was looking for the stylesheet in the wrong directory).

    How do I do the URL rewriting stuff the right way? I'm brand new to it and at a total loss.
    in addition on SlappyTheFish 's post, it is necessary to add BASE HREF in the head of your html pages, so browser will know which is the base directory of the site and properly fetch css, images, etc.
    Take a look on news website http://www.livepage.info where we have the same thing.

    eg. of the code: <html><head><base href="http://www.domain.com/">...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles