.htaccess code needed - will pay $7

Discussion in 'Apache' started by mountainGoat, Mar 30, 2009.

  1. #1
    Need a few lines written in my .htaccess file to redirect from all pages with index.php in URL to root. Currently have several lines, each doing something and I don't really know anything about .htaccess. Kind of in a hurry, can pay with paypal, looking for a solution today. Thanks.
     
    mountainGoat, Mar 30, 2009 IP
  2. seoz

    seoz Banned

    Messages:
    229
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    add this code in your .htacess file
    (if you dont have one
    go to notepad > paste this code > click save > In filename field = .htacsess > save as type field=all files > done > upload it to your root.


    code...(dont include dots/line)
    ------------------------

    Options +FollowSymLinks
    DirectoryIndex index.php

    RewriteEngine On
    RewriteBase /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.YOUR WEBSITE.com/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    ------------------------------
     
    seoz, Mar 30, 2009 IP
    mountainGoat likes this.
  3. mountainGoat

    mountainGoat Active Member

    Messages:
    159
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    75
    #3
    Thanks for the response. The code threw my site into a redirect loop, it's probably clashing with existing code in my .htaccess file. Here's what I have so far:

    <Files ~ "^.(htaccess|htpasswd)$">
    deny from all
    </Files>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.mysite\.com):)80)? [NC]
    RewriteRule ^(.*) http://mysite.com/$1 [R=301,L]
    order deny,allow

    Options +FollowSymLinks
    RewriteCond %{THE_REQUEST} ^.*/index.html
    RewriteRule ^(.*)index.html$ http://mysite.com/$1 [R=301,L]

    Redirect permanent /cj/consulta/index.php http://mysite.com
    order deny,allow

    Redirect permanent /indexbc70.html http://mysite.com/index70.php?option=com_content&view=article&id=45&Itemid=54
    order deny,allow

    Redirect permanent /index.php http://mysite.com

    AddHandler application/x-httpd-php5 .html


    It may be be redundant, I've patched it together w/o really knowing what I'm doing. Anyway, the purpose is to redirect:
    -from www to root
    -from index.html and index.php to root
    -a few page to page redirections
    -and lastly, what I'm having trouble with is the ability to redirect various pages that have filenames like /index.php?option=com_content&view=article&id=68&Itemid=61 to the root of my site.
     
    mountainGoat, Mar 30, 2009 IP