SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question help me out please friendly url

    hello,

    i have resently finished a site but am having a hard time changing the
    url to a friendlly url.

    i have whent to few tutorials online and as well as the article on site point
    for changing the url i just find it hard to follow.

    could some one guide me on how to change the url to friendly one.

    my current dynamic url looks like this

    sitename.com/article-read.php?article_name=A%20Article%20title,%20for%20example


    am traying to make it something like this

    sitename.com/article-read/article_name/A-Article-title,-for-example

    you could suggest something better?

    would someone help me please

    greatfull thank you.
    Last edited by hisham777; Sep 11, 2006 at 09:04.
    Never be shy to ask silly Qs
    An answer is always better than none

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,449
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Do you use the Apache web server?

  3. #3
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for reply

    yes my webhost use apache Server
    Never be shy to ask silly Qs
    An answer is always better than none

  4. #4
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,449
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Ok, cool. Mod_rewrite will be able to do this for you. I'm going to move this to our apache forum where our gurus can help.

    In the meantime, if you want to try this yourself, you can find a good tutorial on how to use mod_rewrite check out the SitePoint article: mod_rewrite: A Beginner's Guide to URL Rewriting. Also, read our sticky mod_rewrite Resources.

  5. #5
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks stymiee,

    i thought the selution are mix of Apache configration and some php script
    thats why i posted it her.

    you know better.

    thanks
    Never be shy to ask silly Qs
    An answer is always better than none

  6. #6
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stymiee
    In the meantime, if you want to try this yourself, you can find a good tutorial on how to use mod_rewrite check out the SitePoint article: mod_rewrite: A Beginner's Guide to URL Rewriting. Also, read our sticky mod_rewrite Resources.
    my eyes cannot follow the article anymore Beginner's Guide to URL Rewriting
    ahhh.

    i have no experience in Apache at all i tried reading the http://httpd.apache.org/docs-2.0/misc/rewriteguide.html its hard to follow.

    any help Gurus.
    Never be shy to ask silly Qs
    An answer is always better than none

  7. #7
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok googling around i got this solution
    by adding this to the .htaccess

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule article-read/article_name/(.*)/ article-read.php?article_name=$1
    RewriteRule article-read/article_name/(.*) article-read.php?article_name=$1

    when i add this url
    travellersmind . com/testurl/article-read/article_name/and add the article name her

    it gives me the article but, my CSS images all are not picked by the browser

    is this the right way to do it?

    if its the right way how to solve the css and images issue
    thanks
    Last edited by hisham777; Sep 11, 2006 at 09:03.
    Never be shy to ask silly Qs
    An answer is always better than none

  8. #8
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    his,

    That's he "pseudo directory" problem I discuss in my signature's tutorial. The recommended solution is to provide the HTML <base> tag in the script.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  9. #9
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn
    his,

    That's he "pseudo directory" problem I discuss in my signature's tutorial. The recommended solution is to provide the HTML <base> tag in the script.

    Regards,

    DK
    i tryed to follow the tutorial you provided ended there are few things i learn about .htaccess thanks.

    but its still does not solve my problem

    my script are in the main directory not in folders, i structered my site in
    this way. and i tried the example you provided it did not work the one with
    test.php and test.html

    as well i dont know how to enable this modeller
    LoadModule rewrite_module modules/mod_rewrite.so

    there are a way to change this am using a web host i dont know if there is a way to change it through cpanel?
    Never be shy to ask silly Qs
    An answer is always better than none

  10. #10
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    his,

    'Glad the tutorial helped someone else!

    The scripts can be in any folder - you just need to be able to have the .htaccess in that directory or above (in the web space so Apache is able to read it).

    If the test I provided isn't working, then I'd think that your mod_rewrite is NOT enabled. If you are running PHP, run a simple script: phpinfo(); and look at the output to see if mod_rewrite's enabled (it'll tell you near the top).

    You can't control this with CPanel, the host must configure this on the server - and, if it's not already configured, it's likely that the host will NOT configure it for you. Since so many do, my recommendation would be to find a good server and move.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  11. #11
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you for the consideration to help.
    am sorry to be pain regarding this its just i have no background in apache

    Quote Originally Posted by dklynn
    his,

    'Glad the tutorial helped someone else!

    The scripts can be in any folder - you just need to be able to have the .htaccess in that directory or above (in the web space so Apache is able to read it).
    the host allow me to but .htaccess files no problems.

    apache v 1.3++


    Quote Originally Posted by dklynn
    If the test I provided isn't working, then I'd think that your mod_rewrite is NOT enabled. If you are running PHP, run a simple script: phpinfo(); and look at the output to see if mod_rewrite's enabled (it'll tell you near the top).
    i checked the phpinfo

    under apache

    section Loaded Modules

    there is mod_rewrite

    so i guess its on

    Quote Originally Posted by dklynn
    You can't control this with CPanel, the host must configure this on the server - and, if it's not already configured, it's likely that the host will NOT configure it for you. Since so many do, my recommendation would be to find a good server and move.

    Regards,

    DK
    am on a limited bugded her.

    they however do have a section in the cpanel called Apache handler
    so i guess its where you can control apache models Right?

    i have read several threads regarding the url thing and i dont blam you for
    creating a page specially meant for url.

    any more help from you ms Guru

    Note: i did try to follow few tutorials and i added this into htaccess
    <files article>
    ForceType application/x-httpd-php
    </files>

    it treated the file called article as php file with out its extention.
    Last edited by hisham777; Sep 12, 2006 at 05:41.
    Never be shy to ask silly Qs
    An answer is always better than none


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
  •