1
nmshah
how to set 301 redirection in xoops
  • 2008/11/10 10:17

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


I am planning to use smartsection as my content module instead of the pico module which I am using currently. There are around 50 pages. I wish to set a 301 redirection for the old pages from pico module. What should be the code in the .htaccess file to do this.

Example of old url by pico
http://makingdestiny.com/modules/positive_thinking_power/index.php?content_id=1

Emample of new url generated by smartsection clone
http://makingdestiny.com/believe.item.1/positive-thinking-concept.html

Please help

2
ghia
Re: how to set 301 redirection in xoops
  • 2008/11/10 10:28

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Or you could edit /modules/positive_thinking_power/index.php to do the redirects in php depending on the asked content_id.

3
nmshah
Re: how to set 301 redirection in xoops
  • 2008/11/10 10:49

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Is there a way to use .htaccess file for the redirection because i have uninstalled the pico module. I dont really know how to do this. But i am ready to work and learn.

btw on seraching net i found this quote which i added to my .htaccess file but it did not work

redirect 301 /modules/positive_thinking_power/index.php?content_id=1 http://makingdestiny.com/believe.item.1/positive-thinking-concept.html

On further search i found that the code in this format works for static pages only. So is there a way to modify this code to work for me.

Thanks for the reply

4
nmshah
Re: how to set 301 redirection in xoops
  • 2008/11/10 23:24

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


can somebody teach me how to use this redirect thing and whats the difference between rewrite and redirect.

Also lets start will just redirecting one url. So if instead of all the pages i only intend to redirect one page ie

http://makingdestiny.com/modules/positive_thinking_power/index.php?content_id=1

to

http://makingdestiny.com/believe.item.1/positive-thinking-concept.html

what should i be doing.

5
ghia
Re: how to set 301 redirection in xoops
  • 2008/11/11 1:59

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Try
Quote:
RewriteRule ^modules/positive_thinking_power/index\.php.*$ believe.item.%1/positive-thinking-concept.html [NC,L]

6
sailjapan
Re: how to set 301 redirection in xoops

Quote:
can somebody teach me how to use this redirect thing and whats the difference between rewrite and redirect.


mod_rewrite, a beginner’s guide (with examples)
Courtesy Google
Never let a man who does not believe something can be done, talk to a man that is doing it.

7
nmshah
Re: how to set 301 redirection in xoops
  • 2008/11/12 7:18

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Thanks a lot
Quote:
RewriteRule ^modules/positive_thinking_power/index\.php.*$ believe.item.%1/positive-thinking-concept.html [NC,L]


What the above example does is sends the visitor to the new page but still shows the old url. Waht I am looking for is to send the person to the new page and also show the new url in the url bar of the browser.
Quote:

mod_rewrite, a beginner’s guide (with examples)
Courtesy Google

Thanks for the link will check it out

8
ghia
Re: how to set 301 redirection in xoops
  • 2008/11/12 10:16

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
Thanks for the link will check it out
Then you will see your answer there:
Quote:
Optional Flags
R[=code] - Redirect. The user’s web browser will be visibly redirected to the substituted URL. If you use this flag, you must prefix the substitution with http://www.somesite.com/, thus making it into a true URL. If no code is given, then a HTTP reponse of 302 (temporarily moved) is sent.

9
nmshah
Re: how to set 301 redirection in xoops
  • 2008/11/12 12:59

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


Thanks again

The new code
RewriteRule ^modules/positive_thinking_power/index.php.*$ http://makingdestiny.com/believe.item.%1/positive-thinking-concept.html [R=301,NC,L]

takes me to
http://makingdestiny.com/believe.item./positive-thinking-concept.html?content_id=1

which shows page not found as the correct url is
http://makingdestiny.com/believe.item.1/positive-thinking-concept.html


On removing the % sign before 1 from the original code the old url takes me to
http://makingdestiny.com/believe.item.1/positive-thinking-concept.html?content_id=1

This page shows the content but still has ?content_id=1 added to the end of the link.

Another observation is from the above code all pages with content_id=1 or 2 or 3 are redirected to the new page. What i want is to redirect only ?content_id=1 to be redirected and not any other page.

10
nmshah
Re: how to set 301 redirection in xoops
  • 2008/11/12 13:41

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


I have just tried another code
Quote:
RewriteCond %{QUERY_STRING} ^content_id=1
RewriteRule modules/positive_thinking_power/index.php http://makingdestiny.com/believe.item.1/positive-thinking-concept.html [R=301,L]


This redirects only content_id=1 to the required page but still adds ?content_id=1 at the end of the url. Hence the url shown is

http://makingdestiny.com/believe.item.1/positive-thinking-concept.html?content_id=1
instead of
http://makingdestiny.com/believe.item.1/positive-thinking-concept.html

Login

Who's Online

401 user(s) are online (62 user(s) are browsing Support Forums)


Members: 0


Guests: 401


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits