Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Redirects


Go to End


7 Posts   1857 Views

Avatar
KatB

Community Member, 105 Posts

25 March 2008 at 2:33pm

Since SS is not able to replicate the original URI structure, is it possible then to set up redirects in the .htaccess file that would be successful?

eg: Redirect 301 www.domain.com/subdirectory/oldpage.html http://www.domain.com/newpage/

Avatar
KatB

Community Member, 105 Posts

27 March 2008 at 4:40pm

yes:

Redirect 301 /subdirectory/oldpage.html http://www.domain.com/newpage/

Avatar
KatB

Community Member, 105 Posts

8 April 2008 at 4:07pm

I have set the redirects up in the .htaccess file before Silverstripe's block. On clicking links to the older URIs, I get the new URI with a ?url=/oldURI.html.

Should the redirects be after the Silverstripe block? What is the best way to avoid the ?url=/oldURI.html ?

Avatar
KatB

Community Member, 105 Posts

8 April 2008 at 5:57pm

Thanks very much to DesignCity and simon_w who helped me fix my problem on IRC :)))))

Avatar
Fuzz10

Community Member, 791 Posts

9 April 2008 at 2:23am

Please share your solution with the forum... Someone else might need this as well..

Thanks

Avatar
KatB

Community Member, 105 Posts

14 April 2008 at 3:09pm

At the top of .htaccess (before the SilverStripe block) place this:
RewriteRule Directory/File.html newURI/ [R=301,L]

Avatar
Bruce B

Community Member, 164 Posts

3 June 2008 at 1:41pm

Just to expand on the previous post:
If you set up the following (using my own site as the example):
RewriteRule social/maternity/ http://nfaw.org/paid-maternity-leave/ [R=301,L]
RewriteRule social/ http://nfaw.org/women-s-social-policy/ [R=301,L]

The redirects seem to work as expected. The most specific one is triggered first, followed by the more general. You can get users to the most popular entry points directly, while for other pages, they at least land in the right part of the site.

Your web stats program should identify the most common entry points to help with this process.