Changing the URL for doc files

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
11/22/2011 2:39:30 PM
Gravatar
Total Posts 18439

Re: Changing the URL for doc files

If the redirect is working correctly the files don't need to exist in the old location.

ie if you are doing a 301 redirect from:

www.mysite.com/document.pdf

to

www.mysite.com/Data/Sites/1/documents/document.pdf

then if the redirect is actually working the file does not need to exist at

www.mysite.com/document.pdf

So the question is only whether you can get the redirect working or not.

Using the IIS Url Rewrite module you should be able to do it. 

Or if you're trying the way Jamie showed you with web.config you may also need to have this attribute on the modules element

<modules runAllManagedModulesForAllRequests="true">

in the system.webserver section

Hope that helps,

Joe

 

11/22/2011 4:16:26 PM
Gravatar
Total Posts 2240

Re: Changing the URL for doc files

Using URL Rewrite is going to be your best bet. It isn't hard to use and there is a lot of documentation on the IIS.NET website for it.

For what you're trying to do, you should be able to use the following rule:

        <rewrite>
            <rules>
                <rule name="Redirect /Documents/" stopProcessing="true">
                    <match url="^documents/(.*)$" />
                    <action type="Redirect" url="{http_host}/data/sites/1/documents/{R:1}" />
                </rule>
            </rules>
        </rewrite>
The code above is created by the screen below and added to the web.config file (system.webserver section)

You can see this in action on the i7MEDIA website with this url:

i7media.net/documents/i7MEDIAHostingAcceptableUsePolicy.pdf

HTH,
Joe D.

EDIT: Image didn't show up properly, fixed it.

11/22/2011 4:34:56 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Changing the URL for doc files

Hey Joe, that looks good, except I think your screen shot redirect URL is wrong.

I think his issue right now is more with the individual (phantom) files at the root of his site that he needs redirection for. Joe A. was right that the original files don't have to exist to set up redirects for them, but I think at the very least he's going to need a rewrite rule for the root of the site that redirects all *.pdf requests (for instance) to look in the new Data/sites/1/documents directory. I haven't used the URL rewriting module, but given what Joe posted and his link it shouldn't be too difficult to figure out how to do that and set it up.

11/29/2011 3:12:56 PM
Gravatar
Total Posts 23

Re: Changing the URL for doc files

Quick thanks to everyone - I think all the links are working now!

You must sign in to post in the forums. This thread is closed to new posts.