SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Vancouver, USA
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rewrite rule help needed.

    I've got a clients site that was upgraded from the PostNuke CMS to Zikula. In the process of the upgrade, the person who did the upgrade moved the site from living in the subfolder /pn/ to being the root of the domain. The problem I'm running in to now, that they have only just discovered, is that they have old links to things in the subfolder. So, what I need to do is change the following url example:
    http://clientdomain.com/pn/modules.php?op=modload&name=News&file=article&sid=59

    to

    http://clientdomain.com/index.php?module=News&func=display&sid=59

    I have a rewrite rule:


    RewriteRule ^modules\.php\?op=modload&name=News&file=article&sid=([0-9]{1,3})$ /index.php?module=News&func=display&sid=$1

    That reforms the file reference, but the problem is I need the /pn/ to be changed to / as well. I tried adding pn\ to the rule, I tried putting it in the /pn/ folder, but so far I'm not getting anywhere.
    Halbrook Technologies - Web Hosting &
    Zikula Application Framework Services

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

    That's a simple matter of understanding the Apache Redirect directive. I'll let you find all the alternatives but
    Code:
    Redirect 301 /np/ http://clientdomain.com/
    should do the trick for you.

    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

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Vancouver, USA
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I'll give it a shot, and that should go in the web root, not the sub folder correct?
    Halbrook Technologies - Web Hosting &
    Zikula Application Framework Services

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    MH,

    Correct ... but the format I provided was with absolute paths to your DocumentRoot so it shouldn't matter. As a technique, I try to do everything in the DocumentRoot's .htaccess file to avoid confusion about directory levels.

    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
  •