23368 Posts in 18143 Topics by 2863 members
Page: 1 2
|Go to End||Next >|
27 May 2010 at 12:33am
We recently changed our site to SilverStripe. But as we search with a keyword in Google, we still seeing a lot of old url's.
How can I change them. exp.:
/products.asp?productgroupid=5&language=nl to the /products?
I've seen a lots of posts where they suggest to work with a .htaccess file, but that doesnt work.
27 May 2010 at 3:16am
weird, I came here to ask the same question.
basically I want to do a redirect before the rewrite rule takes effect.
so if my old site was "mysite.com/old/page"
I want to first have that resolve to "mysite.com/new/page"
the way I see it there should be two steps
1) turn the request for "mysite.com/old/page" into a request for "mysite.com/new/page"
2) the htaccess rewrite rules takes "mysite.com/new/page" and performs as usual
how does one do this? surely there must be some sort of .htaccess voodoo to accomplish it?
28 May 2010 at 1:30am
28 May 2010 at 2:15am
Just put the rewrite-rules before any SilverStripe rules, but after RewriteBase (if that exists in your setup).
RewriteRule ^products.asp$ /products[R=301,QSA,L]
# SilverStripe Rewrites go here
This will redirect products.asp to /products.. the QSA option tells the rewrite Engine to keep the query string (eg. ?productgroupid=5&language=nl)
28 May 2010 at 2:19am
Superb ! Thx!
28 May 2010 at 2:23am Last edited: 28 May 2010 2:24am
wow, I tried this numerous ways yesterday and never got it quite right. I'd have the wrong url with the right content, the right url with the wrong content, totally new weird urls that I didn't intend. anyway, this works, I owe you a beer!
QSA was what I was missing all along.
28 May 2010 at 2:32am
Should you still have a 404 error page in SilverStripe? Because I still got the 404 error page, even if I add that code in my .htaccess file
28 May 2010 at 2:37am
FYI, here is a useful tweak if you want to direct sub directories
RewriteRule ^old/(.*)$ /new/$1 [R=301,QSA,L]
so mysite.com/old/page now goes to mysite.com/new/page
Page: 1 2
|Go to Top||Next >|