SitePoint Sponsor

User Tag List

Results 1 to 15 of 15

Thread: rewrite

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Southern Maine
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    rewrite

    Hey all, I am trying to use rewrite for my tutorial site with id?=1 and I have the following:

    [code
    RewriteEngine On
    ]RewriteRule ^rks/showcode/([0-9]+)/?$ rks/showcode.php?id=$1 [NC,L]
    [/code]

    It shows just the main text on the page and not what I am getting from id=1, any suggestions?

    -Ryan
    Working on a new CSS site for RKS and PHP driven?

    Looking for staff, tutorial site for coding, and photshop. PM me.

  2. #2
    With More ! for your $ maxor's Avatar
    Join Date
    Feb 2004
    Location
    Scottsdale, Arizona
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this...

    Code:
    RewriteEngine On
    RewriteRule ^rks\/showcode\/([0-9]+)/?$ rks/showcode.php?id=$1 [L]

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Southern Maine
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey.. thanks for the tip, but I am still getting that same thing. just the HTML on that page, nothing from the database but when I go to the actual link

    http://localhost/rks/showcode.php?id=1

    I get the variables to show on the page.

    Thanks, Ryan
    Working on a new CSS site for RKS and PHP driven?

    Looking for staff, tutorial site for coding, and photshop. PM me.

  4. #4
    SitePoint Wizard Dean C's Avatar
    Join Date
    Mar 2003
    Location
    England, UK
    Posts
    2,906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    RewriteEngine On
    RewriteRule ^showcode/([0-9]+)/?$ showcode.php?id=$1 [L]
    Put this in a .htaccess file in the rks directory

  5. #5
    With More ! for your $ maxor's Avatar
    Join Date
    Feb 2004
    Location
    Scottsdale, Arizona
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hrm. Where is the showcode.php page located? What about the .htaccess file?

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Southern Maine
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey guys.. thanks for the tips.

    I just created a .htaccess file and pasted that in.

    [code]
    RewriteEngine On
    RewriteRule ^showcode/([0-9]+)/?$ showcode.php?id=$1 [L]
    [\code]

    and I went to:

    http://localhost/rks/showcode/1

    And it still did the same thing. the .htaccess file is in the dir RKS. The showcode.php file is also in the RKS dir.

    Thanks for your help guys, Ryan
    Working on a new CSS site for RKS and PHP driven?

    Looking for staff, tutorial site for coding, and photshop. PM me.

  7. #7
    With More ! for your $ maxor's Avatar
    Join Date
    Feb 2004
    Location
    Scottsdale, Arizona
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're sure that you've got mod_rewrite installed and that it's working? What OS is this?

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Southern Maine
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heh.. im a fool , I forgot all about that, heh. where would I go to install it. I just probably drove you crazy. Can I find it at the apache site? I dont have much knowledge in .htaccess.

    -Ryan
    Working on a new CSS site for RKS and PHP driven?

    Looking for staff, tutorial site for coding, and photshop. PM me.

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

    Have a look at http://datakoncepts.com/seo as that tries to summarize SEO (what you're doing) from activating the mod_rewrite in Apache to use (retaining relative links which will disappear on you when you get your code working).

    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

  10. #10
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Southern Maine
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Dk, I went there and followed the setup and I tried it again and it didnt work? Any other suggestions?

    Thanks, Ryan
    Working on a new CSS site for RKS and PHP driven?

    Looking for staff, tutorial site for coding, and photshop. PM me.

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

    Uh, oh!

    AllowOverrides All? Un-commented the mod_rewrite.so? Those two should have done it for you.

    Then RewriteEngine On as the first thing (before your RewriteCond_itions and Rules) are all that's necessary.

    Once you get that far, try a simple rewrite rule as a first test.

    Can you please let us know WHAT you've done and WHAT response you're getting from Apache? Thanks!

    We'll get you there.

    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

  12. #12
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Southern Maine
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey DK, thanks for all your help! Yeah, haha, I was like what! haha. Here is the code I am using in my .htaccess in RKS.

    Code:
    RewriteEngine On
    RewriteRule ^showcode/([0-9]+)/?$ showcode.php?id=$1 [L]
    All that stuff you said is checked and done,, haha. I go to the rewrite URL and it just shows the HTML on the page no CSS (which I read and it wouldnt) and not the information from ID = 1.

    Thanks for your help, Ryan
    Working on a new CSS site for RKS and PHP driven?

    Looking for staff, tutorial site for coding, and photshop. PM me.

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

    Too late for me to try to figure out whether this is sorted for you but it seems like you've got "The Dreaded SEO Directory Problem" which is described (without the dramatics but with the solution) at http://www.datakoncepts.com/seo.

    No worries, the ?id=1 is hidden UNLESS you make it visible with a Permanent redirect (you DON'T want to do that!) but Apache will think it's in the rks/showcode OR rks/showcode/{digits} directory and there IS a way outta that one!

    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

  14. #14
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Southern Maine
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey DK, I wnet there before and did add the base URL tag to my page and it still doesnt recieve the information and I followed and read that page? Could it be the rewrite rule im using? or is that fine?

    Thanks for your help!

    ryan
    Working on a new CSS site for RKS and PHP driven?

    Looking for staff, tutorial site for coding, and photshop. PM me.

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

    No, you're mod_rewrite looked just fine.

    The BASE tag will tell Apache that the script is where YOU tell it that it is. In other words, you can use relative links but have to tell Apache the correct location from which it will fetch the relative links.

    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


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
  •