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/xoopsheadline/"'",
     
"'(?     "'(?//)modules/mydownloads/"'",
     
"'(?     "'(?//)modules/mylinks/"'",
     
"'(?     "'(?//)modules/xoopspartners/"'",
     
"'(?     "'(?//)modules/contact/"'",
     
"'(?     "'(?//)modules/addresses/"'",
     
"'(?     "'(?//)modules/piCal/"'",
     
"'(?     "'(?//)modules/xdonations/"'",
     
"'(?     "'(?//)modules/flashchat/"'",

    
"'(?    "'(?//)article.php?storyid=([0-9]*)''",    
    
"'(?,
    
"'(?,
    
"'(?,
    
"'(?,
    
"'(?    "'(?//)archive.php?year=([0-9]*)&month=([0-9]*)'",

    
"'(?,
    
"'(?,

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

//    "'(?//    "'(?    
"'(?,
    
"'(?    "'(?//)modules/addresses/visit.php?cid=([0-9]*)&lid=([0-9]*)''",

    
"'(?    "'(?//)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

319 user(s) are online (242 user(s) are browsing Support Forums)


Members: 1


Guests: 318


margoritka,

more...

Donat-O-Meter

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

Latest GitHub Commits