change url using htaccess file

Discussion in 'Apache' started by kipper777, Sep 26, 2011.

  1. #1
    I need to change this link:
    http://www.expressnightout.com/content/2011/08/beyond_wagon_wheels_and_calico_country_c.php.
    to
    http://www.expressnightout.com/2011/08/beyond_wagon_wheels_and_calico_country_c/

    Form the old site, there are many backlinks out there that I simply cannot change, so I need to write a rule to remove the /content/ AND take the .php off

    If you could help me write and/ or show me a good resource so I can figure this out myself. That would be great. Thanks
     
    kipper777, Sep 26, 2011 IP
  2. kipper777

    kipper777 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is there anyone there who can answer this???
     
    kipper777, Sep 26, 2011 IP
  3. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #3
    You may be able to do something like this:

    RewriteEngine On
    RewriteRule ^/content/(\d+)/(\d+)/(.*)\.php$ http://www.expressnightout.com/$1/$2/$3/ [R=301,L]

    Haven't tested it, so you may want to play around with it, but that's my $0.02
     
    zacharooni, Sep 27, 2011 IP
  4. kipper777

    kipper777 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you so much. The client is trying it, but this looks good. His first attempt did not work but I think his placement was wrong.

    <code>

    # BEGIN WordPress

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    RewriteRule ^/content/(\d+)/(\d+)/(.*)\.php$ http://www.expressnightout.com/$1/$2/$3/ [R=301,L]

    php_value max_execution_time 600
    php_value upload_max_filesize 100M
    php_value post_max_size 100M

    </code>
     
    kipper777, Sep 28, 2011 IP