1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Mod_rewrite trouble!!!! Grrr!!!!!!

Discussion in 'Apache' started by Nintendo, Oct 8, 2005.

  1. #1
    I know, I know! You're thinking 'What the heck?? YOU asking a mod_rewrite questin?? U on crack??!!!!' I know!!!!! This is driving me NUTS!!!!!! Enjoy you're fun!!!!!! [​IMG] [​IMG] [​IMG] [​IMG]

    How do I allow a period in the changed part of the URL?? *Huh?? YOU asking a simple question like that???!!! You OK??!!!*

    I got

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^directory/([^.]+)$ directory/index.php?title=$1 [L]

    And
    domain.com/directory/Widget_101
    works, but
    domain.com/directory/Widget.101
    doesn't.

    It's a wiki script, so I can't keep visitors from having files created with periods! (On wikipedia.org, URLs do work with periods!!)

    RewriteRule ^directory/([^.]+)\.([^.]+)\.([^.]+)$ directory/index.php?title=$1.$2.$3 [L]
    RewriteRule ^directory/([^.]+)\.([^.]+)$ directory/index.php?title=$1.$2 [L]

    doesn't fix it. Server tries to redirect over and over until it gives up.

    RewriteRule ^directory/(.*)$ directory/index.php?title=$1 [L]

    also doesn't work, even with out the period. It also tries to redirect until it gives up.

    What's driving me nuts even more is that for my Amazon scripts

    RewriteRule ^(.*)/(.*)\.html$ cgi-local/blah.cgi?Operation=ItemLookup&ItemId=$1 [L]

    works with no trouble for....

    domain.com/B000BI4GP6/S.i.d_M.e.i.e.r.s_.Civ.i.l.i.z.a.t.i.o.n_I.V.P.r.e.s.e.l.l_E.d.i.t.i.o.n.html


    You can stop laughing now!!!!!! pwetty pweze!!!!!!!!
     
    Nintendo, Oct 8, 2005 IP
  2. Skeleton

    Skeleton Peon

    Messages:
    116
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have done the following, then both "domain.com/directory/Widget_101" and "domain.com/directory/Widget.101" worked properly.

    First, take your index.php file to one upper level. So it will look like domain.com/index.php not domain.com/directory/index.php
    Then change your .htaccess file with this one:

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^/]+)/(.+)$ /index.php?title=$2 [L]

    I don't know why but that worked.
     
    Skeleton, Oct 8, 2005 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    On other domains I had it in the main directory and it did the same thing! I got this to make it work.... (Still don't understand how!!)

    RewriteCond %{REQUEST_URI} !^/directory/index\.php
    RewriteRule ^directory/([^.]+)\.([^.]+)$ directory/index.php?title=$1.$2 [L]
    RewriteRule ^directory/([^.]+)$ directory/index.php?title=$1 [L]

    I think it's the script's redirect stuff that caused the chaos. index.php for example automatically redirects to index.php?title=Main_Page

    And then I had the CSS chaos! I had to move that to the main directory for that to work. Images and CSS do not like mod_rewrite! ( I even tried <base href="http://www.world-of-nintendo.com/" /> )
     
    Nintendo, Oct 8, 2005 IP
  4. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #4
    RewriteRule ^directory/([^.]+)$ directory/index.php?title=$1 [L]

    is explicitly disallowing periods.

    Try
    RewriteRule ^directory/(.*)$ directory/index.php?title=$1 [L]

    That should grab everything, including periods

    cheers

    johnt
     
    johnt, Oct 9, 2005 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    I think it was the script that was making the redirect chaos. All URLs are created by the index.php wiki file and it has a few redirect things in the file. This is the only script I've ever used that didn't like (.*)! The code in my last post, from jdMorgan fixed it.
     
    Nintendo, Oct 10, 2005 IP