Apache mode_rewrite

Discussion in 'Apache' started by XandroZ, Feb 19, 2009.

  1. #1
    I need to make a redirect from an old url to a new url. The problem is that both urls have a space :

    The problem is that apache doesn't recognize space as %20 or escaped with "\"

    For example the
    http:\\protocols eib.php
    Code (markup):
    I want to redirect to
    http:\\automation protocols.php
    Code (markup):
    .
     
    XandroZ, Feb 19, 2009 IP
  2. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #2
    RewriteEngine on
    RewriteRule ^protocols\ eib\.php$ /automation\ protocols.php [R=301,L]
    
    Code (markup):
    That should do the trick.
     
    tolra, Feb 19, 2009 IP
  3. XandroZ

    XandroZ Peon

    Messages:
    395
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It give 500 error


    I tried something like this:
    
    RewriteEngine On
    RewriteRule ^Firewall/VPN\ Firewall/firewall-vpn-introduction-1\.php$
    /Automation-Computer-Security/computer\ gadgets/computer-security/intranet-vpn\.php [L,R=301]
    Code (markup):
     
    XandroZ, Feb 20, 2009 IP
  4. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #4
    Did you have the RewriteRule all on one line?

    Do you have mod_rewrite installed on the server?

    The following works on my server:
    
    RewriteEngine on
    RewriteRule ^Firewall/VPN\ Firewall/firewall-vpn-introduction-1\.php$ /Automation-Computer-Security/computer\ gadgets/computer-security/intranet-vpn.php [L,R=301]
    
    Code (markup):
     
    tolra, Feb 20, 2009 IP
  5. XandroZ

    XandroZ Peon

    Messages:
    395
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you. I think the problem was that I used Notepad to edit .htaccess and the RewriteRule weren't RewriteRule all on one line.(Notepad wrap the lines)
     
    XandroZ, Feb 21, 2009 IP