PHPNerd3 Posted January 28, 2011 Share Posted January 28, 2011 Hello Everyone, Good evening! Strange issue... here's a block out of my httpd.conf: DocumentRoot "/home/forwardm/public_html/xxxx/" <Directory "/home/forwardm/public_html/xxxx"> RewriteEngine on RewriteRule ^deploy/(.*)$ deploy.php?$1 [NE] </Directory> Basically, I have a URL embedded as a part of a query string and it ends up looking like: http:/url.com (single slash) which is strange. I need to find a way to remedy this. I found some help here: http://stackoverflow.com/questions/4514627/apache-rewrite-rule-leading-slash ... but it was a bit too vague for me. Any clarity that can be offered by the group would be wonderful. Thanks in advance everyone, Joshua Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/ Share on other sites More sharing options...
requinix Posted January 28, 2011 Share Posted January 28, 2011 Apache, amongst others, automatically reduces two slashes into one (when it's part of the URL path). Thus "deploy/http://example.com" becomes "deploy/http:/example.com". You can get around that by inspecting the original and untouched REQUEST_URI, but you need RewriteCond to do so. RewriteEngine On RewriteCond %{REQUEST_URI} ^/deploy/(.*) RewriteRule ^ deploy.php?%1 [NE] Couple notes: a) The REQUEST_URI has a leading slash. It always does. b) I didn't bother having the Rule check the URL - the Cond already did so there's no need. c) Even though deploy.php validates the URL (it does, right?) consider having the Cond (or Rule) do some quick checking too. For example, RewriteCond %{REQUEST_URI} ^/deploy/(http://.*) The drawback is that if the URL is invalid the user will get an error response. Whether that's a good or a bad thing... Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/#findComment-1166413 Share on other sites More sharing options...
PHPNerd3 Posted January 28, 2011 Author Share Posted January 28, 2011 Hello, For some reason, the code suggested below makes it so that my embedded flash assets don't even load, meaning: - This is not properly turning “deploy.php?adid=” to the nice format of “deploy/adid=”. I need the above to happen and still allow for: “deploy/adid=1234&myURLParameter=http://google.com”. Any idea? Thanks so much, I really appreciate everything. Josh Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/#findComment-1166734 Share on other sites More sharing options...
PHPNerd3 Posted January 29, 2011 Author Share Posted January 29, 2011 Basically, this fixes the double slashes issue, however, it now makes it so deploy.php doesn't get recognized as deploy/ I need some urgent help on this :/ Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/#findComment-1166801 Share on other sites More sharing options...
requinix Posted January 29, 2011 Share Posted January 29, 2011 What does your .htaccess look like now? Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/#findComment-1166808 Share on other sites More sharing options...
PHPNerd3 Posted January 31, 2011 Author Share Posted January 31, 2011 # This is for the xxx/xxx systems integration # File must be edited to remove the deploy.php's file extension # because an Internet Explorer bug will prevent Object/Flash embedding otherwise. DocumentRoot "/home/forwardm/public_html/APEXintg/" <Directory "/home/forwardm/public_html/APEXintg"> RewriteEngine on RewriteCond %{REQUEST_URI} ^/deploy/(.*) RewriteRule ^ deploy.php?%1 [NE] </Directory> I removed the virtual hosts + section for privacy pruposes. Thanks so much in advance. I'm stuck as can be. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/#findComment-1167993 Share on other sites More sharing options...
requinix Posted January 31, 2011 Share Posted January 31, 2011 What does "doesn't get recognized" mean? An error? What error? And what if you change the Rule temporarily to RewriteRule ^ deploy.php?%1 [NE,R] What does the address bar say? Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/#findComment-1168008 Share on other sites More sharing options...
PHPNerd3 Posted January 31, 2011 Author Share Posted January 31, 2011 Basically, the embedded flash URL (which is what we're working on) ends up looking like this: http://testingserver123.net/APEXintg/deploy/adid=997&cid=151131&sid=&afid=138983&affiliatereferenceid=&creativeID=464009&affURL=http://google.com/ - The URL query parameter now has two slashes (good) - Now, if the URL is copied into a browser, it looks like this: The requested URL /APEXintg/deploy/adid=997&cid=151131&sid=&afid=138983&affiliatereferenceid=&creativeID=464009&affURL=http://google.com/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at forwardmotions.net Port 80 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/225920-double-slashes-converted-into-single-slash-for-some-reason/#findComment-1168050 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.