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.

htaccess redirect all files to index page

Discussion in 'Apache' started by byoung, Jun 21, 2006.

  1. #1
    i've been working with a joomla site and want to redirect all requests in a subdirectory to the main page. I can't seem to do it with standard rewriterule or 301 redirects. I suspect its joomla interfering, any help?/tips?
     
    byoung, Jun 21, 2006 IP
  2. DXL

    DXL Peon

    Messages:
    380
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Maybe something is wrong with your .htaccess code. This should do:
    RewriteEngine On
    RewriteRule subdir/?.* http://example.com/ [R=301,L]

    If you do not want to redirect /subdir/ (without anything behind it) you should use subdir/.+ instead.
     
    DXL, Jun 22, 2006 IP
  3. byoung

    byoung Peon

    Messages:
    106
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hmm, still can't get that to work, the normal joomla htaccess has:

    RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*) index.php

    So i put this rule in before any of those and still can't get it to work, joomla just redirects it to its 404 page, which i gather means it can't find it so goes to index.php which directs to its generated 404 page, which means the rule can't be overriding the index.php one.
     
    byoung, Jun 22, 2006 IP
  4. DXL

    DXL Peon

    Messages:
    380
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try /index.php instead of index.php
     
    DXL, Jun 23, 2006 IP
  5. byoung

    byoung Peon

    Messages:
    106
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    sorry, the rules i posted above are the existing rules for joomla. They currently work, i want to put one like: RewriteRule subdir/?.* http://example.com/ [R=301,L] so that old folders will redirect somewhere else, but those existing rules seem to keep overriding this.
     
    byoung, Jun 23, 2006 IP
  6. byoung

    byoung Peon

    Messages:
    106
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    can anyone offer further advice as i can't seem to get the new rule to fit in with the existing ones.
     
    byoung, Jul 11, 2006 IP