okey666 Posted January 28, 2009 Share Posted January 28, 2009 On my .php web pages, when a ~ is added after the .php (in the address bar), the php code does not execute, and is simply displayed. Whay is this happenning? and how can I solve it? I am a relative begginner at php. Quote Link to comment https://forums.phpfreaks.com/topic/142792-solved-tildes-~-causes-code-to-be-displyed/ Share on other sites More sharing options...
DjMikeS Posted January 28, 2009 Share Posted January 28, 2009 Does php work when calling a php page without the ~ ? When I try this on my own webserver, it simply displays a 404... Quote Link to comment https://forums.phpfreaks.com/topic/142792-solved-tildes-~-causes-code-to-be-displyed/#findComment-748455 Share on other sites More sharing options...
rhodesa Posted January 28, 2009 Share Posted January 28, 2009 it may sound silly, but make sure there isn't a second file with the same name plus a ~ a lot of the time when i'm changing system files, i'll copy it to a filename like that before editing it Quote Link to comment https://forums.phpfreaks.com/topic/142792-solved-tildes-~-causes-code-to-be-displyed/#findComment-748464 Share on other sites More sharing options...
trq Posted January 28, 2009 Share Posted January 28, 2009 I have seen this error before, unfortunately however I cannot remember the fix. One thing you could do is attempt a redirect back to the valid file. Something like.... RewriteRule ^(.+)~$ http://%{HTTP_HOST}/$1 [R=301,L] Quote Link to comment https://forums.phpfreaks.com/topic/142792-solved-tildes-~-causes-code-to-be-displyed/#findComment-748502 Share on other sites More sharing options...
okey666 Posted January 28, 2009 Author Share Posted January 28, 2009 it may sound silly, but make sure there isn't a second file with the same name plus a ~ a lot of the time when i'm changing system files, i'll copy it to a filename like that before editing it Its not silly. I just remembered, I am on a Ubuntu system which creates system files with ~ at the end. Using FTP, I can see files, I am just going to delete them.... Thanks alot, it works beautifully now. Great forum by the way, very active. Quote Link to comment https://forums.phpfreaks.com/topic/142792-solved-tildes-~-causes-code-to-be-displyed/#findComment-748634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.