1
gruessle
mod rewrite
  • 2006/1/6 7:49

  • gruessle

  • Friend of XOOPS

  • Posts: 348

  • Since: 2003/9/20


I am trying to clean this up, turn it in to English and make it work on some additional modules but I can't figure this out.
Can you take a moment and explain this to me?

Below is my code but in addresses visit.php (singlelink.php is called visit.php in the addresses module) just does not work and it should be allmost the same as in mylinks.

The most I am confused about is the endings as in:
([0-9]*)"'",
([
0-9]*)''",
or
"'",
/"'",


When do you use what and why?

Options +FollowSymlinks
RewriteEngine On

RewriteRule 
^index.html$    index.php    [L]

#Main Menu
RewriteRule ^news.html$                  modules/news                                    [L]
RewriteRule ^headlines.html$             modules/xoopsheadline                           [L]
RewriteRule ^forum.html$                 modules/newbb                                   [L]
RewriteRule ^downloads.html$             modules/mydownloads                             [L]
RewriteRule ^polls.html$                 modules/xoopspoll                               [L]
#RewriteRule ^mylinks.html$               modules/mylinks                                 [L]
RewriteRule ^faq.html$                   modules/xoopsfaq                                [L]
RewriteRule ^partners.html$              modules/xoopspartners                           [L]
RewriteRule ^members.html$               modules/xoopsmembers                            [L]
RewriteRule ^contact.html$               modules/contact                                 [L]
RewriteRule ^gallery.html$               modules/xoopsgallery                            [L]
RewriteRule ^links.html$                 modules/addresses                               [L]
RewriteRule ^articles.html$              modules/wfsection                               [L]
RewriteRule ^calendar.html$              modules/piCal                                   [L]
RewriteRule ^classifieds.html$           modules/myAds                                   [L]
RewriteRule ^donations.html$             modules/xdonations                              [L]
RewriteRule ^weather.html$               modules/vlweather                               [L]
RewriteRule ^chat.html$                  modules/flashchat                               [L]
     
#Articles
RewriteRule ^modules/news/article-([0-9]+).html$                    modules/news/article.php?storyid=$1             [L]
RewriteRule ^modules/news/article-cat-([0-9]+)-start-([0-9]+).html$     modules/news/index.php?storytopic=$1&start=$2   [L]
RewriteRule ^modules/news/article-([0-9]+)-page-([0-9]+).html$      modules/news/article.php?storyid=$1&page=$2     [L]
RewriteRule ^modules/news/article-cat-([0-9]+).html$                modules/news/index.php?storytopic=$1            [L]
RewriteRule ^modules/news/article-print-([0-9]+).html$              modules/news/print.php?storyid=$1               [L]
RewriteRule ^modules/news/archive.html$                             modules/news/archive.php                        [L]
RewriteRule ^modules/news/archive-([0-9]+)-([0-9]+).html$           modules/news/archive.php?year=$1&month=$2       [L]

#mylinks
#RewriteRule ^modules/mylinks/links-cat-([0-9]+).html$        modules/mylinks/viewcat.php?cid=$1                      [L]
#RewriteRule ^modules/mylinks/link-([0-9]+)-([0-9]+).html$         modules/mylinks/singlelink.php?cid=$1&lid=$2         [L]
#addresses
RewriteRule ^modules/addresses/links-cat-([0-9]+).html$        modules/addresses/viewcat.php?cid=$1                      [L]
RewriteRule ^modules/addresses/visit-([0-9]+)-([0-9]+).html$     modules/addresses/visit.php?cid=$1&lid=$2         [L]

function replace_for_mod_rewrite(&$s) {    
  
$urlin = array(
     
"'(?<!//)modules/news/"'",
     "'
(?<!//)modules/xoopsheadline/"'",
     
"'(?<!//)modules/newbb/"'",
     "'
(?<!//)modules/mydownloads/"'",
     
"'(?<!//)modules/xoopspoll/"'",
     "'
(?<!//)modules/mylinks/"'",
     
"'(?<!//)modules/xoopsfaq/"'",
     "'
(?<!//)modules/xoopspartners/"'",
     
"'(?<!//)modules/xoopsmembers/"'",
     "'
(?<!//)modules/contact/"'",
     
"'(?<!//)modules/xoopsgallery/"'",
     "'
(?<!//)modules/addresses/"'",
     
"'(?<!//)modules/wfsection/"'",
     "'
(?<!//)modules/piCal/"'",
     
"'(?<!//)modules/myAds/"'",
     "'
(?<!//)modules/xdonations/"'",
     
"'(?<!//)modules/vlweather/"'",
     "'
(?<!//)modules/flashchat/"'",

    
"'(?<!//)article.php?storyid=([0-9]*)"'",
    "'
(?<!//)article.php?storyid=([0-9]*)''",    
    
"'(?<!//)modules/news/article.php?storyid=([0-9]*)&amp;page=([0-9]*)'",
    
"'(?<!//)index.php?storytopic=([0-9]*)&amp;start=([0-9]*)'",
    
"'(?<!//)index.php?storytopic=([0-9]*)'",
    
"'(?<!//)print.php?storyid=([0-9]*)'",
    
"'(?<!//)modules/news/archive.php"'",
    "'
(?<!//)archive.php?year=([0-9]*)&amp;month=([0-9]*)'",

    
"'(?<!//)modules/mydownloads/viewcat.php?cid=([0-9]*)'",
    
"'(?<!//)modules/mydownloads/singlefile.php?cid=([0-9]*)&amp;lid=([0-9]*)'",

    
"'(?<!//)modules/xoopsgallery/"'",

    "'
(?<!//)modules/xoopspoll/"'",

//    "'(?<!//)modules/mylinks/viewcat.php?cid=([0-9]*)'",
//    "'(?<!//)modules/mylinks/singlelink.php?cid=([0-9]*)&amp;lid=([0-9]*)'",
    
"'(?<!//)modules/addresses/viewcat.php?cid=([0-9]*)'",
    
"'(?<!//)modules/addresses/visit.php?cid=([0-9]*)&amp;lid=([0-9]*)"'",
    "'
(?<!//)modules/addresses/visit.php?cid=([0-9]*)&amp;lid=([0-9]*)''",

    
"'(?<!//)modules/xoopsmembers/"'",
    "'
(?<!//)modules/contact/"'",
    
);
    
$urlout = array(
     
"news.html"",
     "
headlines.html"",
     
"forum.html"",
     "
downloads.html"",
     
"polls.html"",
     "
links.html"",
     
"faq.html"",
     "
partners.html"",
     
"members.html"",
     "
contact.html"",
     
"gallery.html"",
     "
links.html"",
     
"articles.html"",
     "
calendar.html"",
     
"classifieds.html"",
     "
donations.html"",
     
"weather.html"",
     "
chat.html"",
    
"article-\1.html"",
    "
article-\1.html'",    
    "modules/news/article-\1-page-\2.html",
    "article-cat-\1-start-\2.html",
    "article-cat-\1.html",
    "article-print-\1.html",
    "modules/news/archive.html"",
    "archive-\1-\2.html",

    "modules/mydownloads/downloads-cat-\1.html",
    "modules/mydownloads/downloads-\1-\2.html",

    "gallery.html"",

    "polls.html"",

//    "modules/mylinks/links-cat-\1.html",
//    "modules/mylinks/link-\1-\2.html",
    "modules/addresses/links-cat-\1.html",
    "modules/addresses/visit-\1-\2.html"",
    "modules/addresses/visit-\1-\2.html'",

    "
members.html"",
    
"contact.html"",

    );



    
$s = preg_replace($urlin$urlout$s);

    return 
$s;
}
Grüssle
......

http://www.vmclinks.com

Login

Who's Online

170 user(s) are online (92 user(s) are browsing Support Forums)


Members: 0


Guests: 170


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits