Jump to content

Recommended Posts

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

 

 

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...

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

 

# 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]

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.