GetSimple Support Forum

Full Version: 301 redirects problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I've just set up my first site with this CMS, it's very good! I'm just having a problem redirecting some old urls from my old site which was on Moodle cms to new pages i've created with GetSimple. I've looked at the threads in this forum on redirecting but have had no luck so far.

This is how the last part of my .htaccess looks at the moment:

# handle rewrites for fancy urls
<IfModule mod_rewrite.c>
RewriteEngine on

# Usually RewriteBase is just '/', but
# replace it with your subdirectory path
RewriteBase /

RewriteRule ^mod/page/view.php?id=3 http://mydomain.org/about-us/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
</IfModule>

I just can't get it to redirect mod/page/view.php?id=3 to my about-us page. Any help would be greatly appreciated.
I think, "redirect" is not the way for showing a page "from outside inside".

I would either place your link to a new (or existing) page) with a separate link,
or just copy the text wanted into a new page and make it visible via the menu or
a component (in the sidebar), within your site.
Thanks for your help. I think maybe i didn't make it clear what i meant.
I haven't created a new website with GetSimple, i took an old website that was powered by moodle, and remade it with GetSimple. But that left me with some old urls still indexed by google that i now need to 301 redirect to the new page urls.

For example, i had an 'about us' page at this url: www.turningpointtraining.org/mod/page/view.php?id=3 , but now it's on GetSimple and the url is: www.turningpointtraining.org/about-us/

Normally i would just set up a 301 redirect in the .htaccess to tell search engines that that page is now at a different url. But the 301 redirect isn't working for some reason.

Hope that makes sense.
RewriteRule ^mod/page/view.php?id=3$ about-us [R=301,L]
?

Does the old url have the same path as the new root ?

works for me

Code:
    RewriteBase /
    RewriteRule ^mod/page/view.php?id=3$ test.php [R=301,L]

oh and always test with 302 not 301 until you know it works, 301 means DO NOT EVEN BOTHER RECHECKING THIS PAGE AGAIN
so its basically cached really hard, so your changes might not even be requested by your browser, while testing.


and make sure your rewrites were working to begin with.
for example does about-us even go to index.php?id=aboutus
Hi,

Still can't get it to work for some reason. The last part of my .htaccess file looks like this:

# handle rewrites for fancy urls
<IfModule mod_rewrite.c>
RewriteEngine on

# Usually RewriteBase is just '/', but
# replace it with your subdirectory path
RewriteBase /
RewriteRule ^mod/page/view.php?id=3$ about-us [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
</IfModule>

I'm trying the 302 first like you suggested. I've checked it also on a different PC in case of browser caching issues.

I wonder why it's ignoring it, all i get is my website with: "We are sorry, but the page you are looking for does not exist."
are you sure GS is in /
and not a subdirectory?

does visiting
domain.com/about-us
work ?
Thanks for your help.

No GS isn't in a subdirectory. And you can access that url as:

www.turningpointtraining.org/about-us/
rule looks ok.
maybe try

RewriteRule ^/mod/page/view.php?id=3$ about-us [R=302,L]
maybe remove the querystring and test it, reduce it to simpler and simpler tests

RewriteRule ^mod/page/view.php$ about-us [R=302,L]
RewriteRule ^mod/page/view.php$ /about-us [R=302,L]

RewriteRule ^mod$ about-us [R=302,L]
Thanks a lot for trying to help me solve this, i did try your suggestions and a few others but still couldn't get it to work. I went back to the hosting company in the end to ask them to look into it and they said:
"The '?' at the end stops the ?id=3 being added to the end of the new URL."

Their solution was:

RewriteEngine On
RewriteCond %{REQUEST_URI} /mod/page/view.php
RewriteCond %{QUERY_STRING} ^id=3$
RewriteRule (.*) /about-us? [R=301,L]
What version of Apache ? Works for me.
Yes the method the host gave me works fine and i've been able to add further 301s that way too. Thanks again.
let me know what version of apache if you get a chance.
I specifically tested that on mine and i had no issues with querystring matching.
So i am curious
(2015-02-27, 19:52:53)Rob1n Wrote: [ -> ]Their solution was:

RewriteEngine On
RewriteCond %{REQUEST_URI} /mod/page/view.php
RewriteCond %{QUERY_STRING} ^id=3$
RewriteRule (.*) /about-us? [R=301,L]

THANK YOU! Heart I tried so many things all day, even some redirect plugins, of which NONE of them worked. THIS finally worked!

Sorry, I don't know apache version or I'd share that with you.

Here's what I tested to redirect an outdated URL to the new one:

Code:
RewriteCond %{REQUEST_URI} /articles/diy-horizontal-warping-mill
#RewriteCond %{QUERY_STRING} ^id=3$
RewriteRule (.*) /articles/horizontal-warping-mill [R=302,L]
I have  a question about my last post.

My .htaccess now looks like this

Code:
RewriteCond %{REQUEST_URI} /articles/diy-horizontal-warping-mill/
RewriteRule (.*) /articles/horizontal-warping-mill/ [R=302,L]
RewriteCond %{REQUEST_URI} /articles/diy-horizontal-warping-mill
RewriteRule (.*) /articles/horizontal-warping-mill/ [R=302,L]

RewriteCond %{REQUEST_URI} /articles/diy-simple-tension-device/
RewriteRule (.*) /articles/simple-tension-device/ [R=302,L]
RewriteCond %{REQUEST_URI} /articles/diy-simple-tension-device
RewriteRule (.*) /articles/simple-tension-device/ [R=302,L]

This is working but, is this OK or is there another way I should be writing this? I found out that the "from" URL matters if there's a trailing slash or not so I created these rules to cover both scenarios.