#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    169
    Rep Power
    15

    Another basic rewrite help


    im trying to make an imaginary filename rewrite to another file on the server. this i can work out using

    RewriteRule ^temporay_filename.php /actualfile.php [NS,L]

    now i need to redirect the actual file if it is accessed to display the temporary name so i thought i could just do

    RewriteRule ^actualfile.php /temporay_filename.php [R=301]

    then the errors start coming in.

    any idea what i should be doing?
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    Put that new rule before the other and add an [L].
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    169
    Rep Power
    15
    thanks, i get this error in firefox when i do that.

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
  6. #4
  7. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    Just to be sure, what's in your .htaccess right now?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    169
    Rep Power
    15
    RewriteEngine on
    Options +FollowSymlinks

    RewriteRule ^folder1/actual_file.php /temp_file.php [R=301,L]

    RewriteRule ^temp_file.php /folder1/actual_file.php [NS,L]

    ErrorDocument 404 /404.php
  10. #6
  11. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    Oh, right.

    Try
    Code:
    RewriteEngine on
    Options +FollowSymlinks
    
    RewriteCond %{REQUEST_URI} =/folder1/actual_file.php
    RewriteRule ^ /temp_file.php [R=301,L]
    
    RewriteRule ^temp_file.php /folder1/actual_file.php [NS,L]
    
    ErrorDocument 404 /404.php
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    169
    Rep Power
    15
    still doesnt seem to work when i access actual_file.php
  14. #8
  15. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    Doesn't work how? No redirection? Infinite redirection?

IMN logo majestic logo threadwatch logo seochat tools logo