close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

redirecting a folder

Thread began 10/28/2015 7:21 am by Jamie | Last modified 11/04/2015 11:36 am by Ray Borduin | 2148 views | 10 replies |

Jamie

redirecting a folder

Hey Ray

Am trying to redirect the contents of an entire folder to specific url

eg www.domain.co.uk/subfolder/ to www.domain.co.uk/redirectedurl.php

am trying to get

RedirectMatch 301 /affiliates/(.*) http://www.thevictorianbarn.co.uk/enquiries-booking-form.php


which works fine if its just a folder path that someone is linking from but if someone tries to go to a specific url within the folder, it then appends that file name to the new one.. probably easier to show you. Info in PM

Cheers

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

I don't think you want to use a RedirectMatch 301 type redirect if you aren't redirecting to the specific file in a different folder.

That type of redirect is used specifically for renaming folders. Which means that if you link to a file in the old folder, it will go to the file in the new folder. If you want to just redirect to a single file regardless of the file requested then you would use a standard RewriteRule you can still do a 301 redirect:

RewriteRule ^affiliates(/?.*) enquiries-booking-form.php$1 [R=301,L]

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

thanks Ray... thats rewriting the url to include the path right the way to the server root...

so if you add http://www.domain.co.uk/affiliates/reservations.php gets rewritten to http://www.domain.co.uk/home/domainid/public_html/enquiries-booking-form.php/reservation.php

and if you just do http://www.domain.co.uk/affiliates/ it gets rewritten to http://www.domain.co.uk/enquiries-booking-form.php/ with the trailing slash....

Sign in to reply to this post

Ray BorduinWebAssist

I should have left the $1 off the end... it should just be:

RewriteRule ^affiliates(/?.*) enquiries-booking-form.php [R=301,L]
Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

I had tried that but it makes no difference at all...

Sign in to reply to this post

Ray BorduinWebAssist

I just added the rule to the webassist site and it works, go ahead and try it:

RewriteRule ^folderredirect(/?.*) aboutus.php [R=301,L]

maybe you still have one of the other rules in your .htaccess overwriting it?

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

I can see yours working....don't think I have any conflicting (have put my rewrites in the PM).

Can an htaccess file be cached at all?

Sign in to reply to this post

Ray BorduinWebAssist

Maybe try adding:

RewriteBase /

above the rewrite rule... it looks like the server base url is wrong somehow. This might be a general server configuration issue.

Do the article links work properly?

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

Have added that and no difference.....

Yes, the articles work exactly as expected - before and after adding the above

Sign in to reply to this post

Ray BorduinWebAssist

Have you tried:

RewriteRule ^affiliates(/?.*) /enquiries-booking-form.php [R=301,L]

It sounds like the directory setting is wrong in your server configuration. I googled the problem you are having and found that other people solved it in their apache configuration directly:
http://serverfault.com/questions/93195/mod-rewrite-adding-documentroot-to-url

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...