1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Rewrite rules question

Discussion in 'Server Configuration and Hosting' started by Ranma1981, Jul 11, 2014.

  1. Ranma1981

    Ranma1981 Member

    Hello,

    I noted some errors from Google Webmaster Tools, regard months ago, when I move my forum to sub-domain.

    So, to resolve them, I need to set to rewrite rules, to redirect threads and members, from forum "as sub-folder" to forum "as sub-domain".

    Example:

    Threads:

    mysite.it/forum/threads/la-persona-che-scrive-dopo-di-me.4546/

    To:

    forum.mysite.it/threads/la-persona-che-scrive-dopo-di-me.4546/

    Same thing, for members:

    mysite.it/forum/members/bandmich.48588/

    forum.mysite.it/members/bandmich.48588/

    Please, what are the rules to set these redirects?

    Thanks!
     
  2. Mr Lucky

    Mr Lucky Well-Known Member

    I think you have various possibilities.

    In the root of mysite.it

    Code:
    RewriteRule ^forum/(.*)$ http://forum.mysite.it/$1 [R=301,L]
    or

    Code:
    RewriteCond %{HTTP_HOST} ^(www.)?mysite.it$ [NC]
    RewriteRule ^(forum/)?(.*)$ http://forum.mysite.it/$2 [R=301,L]
    Or very simply in the /forum/ directory of mysite.it

    Code:
    Redirect 301 / http://forum.mysite.it/
     
    Ranma1981 likes this.
  3. Ranma1981

    Ranma1981 Member

    Hello Mermaid,

    thank you, it works fine ;)

    Please, can I ask you another little help? This rewrite rules, give me crazy :D

    I noted other errors from Webmaster Tools, I need to fix these type of urls:

    From:

    http://forum.mysite.it/msn-messenger/34840-eminem-skin-per-msn-messenger.html

    To:

    http://forum.mysite.it/threads/eminem-skin-per-msn-messenger.34840/

    Therefore, there is the the problem that on the first url, frequently change "msn-messenger" to other category name; is there a generic rewrite rule to redirect these url's? Postname and id, fortunately, are always the same.

    Example of another url:

    http://forum.mysite.it/cms/58879-guida-installazione-cms-coppermine-photo-gallery.html

    To:

    http://forum.mysite.it/threads/guida-installazione-cms-coppermine-photo-gallery.58879/

    Thank you very much!
     
  4. Mr Lucky

    Mr Lucky Well-Known Member

    I'm glad the above worked for you.

    I'm not so sure about the other one, you could try:

    Code:
    RewriteCond %{HTTP_HOST} ^(www.)?forum.mysite.it$ [NC]
    RewriteRule ^(msn-messenger/)?(.*)$ http://forum.mysite.it/threads/$2 [R=301,L]
    EDIT: I just noticed this is wrong. I am attempting to change the directory name, but I see the actual html page name is a different format and that is beyond me I'm afraid.
     
  5. Ranma1981

    Ranma1981 Member

    Hello,

    it is the "category name", so it change with the name of the category of the forum; it was generated automatically when I used vBulletin + vBSEO.
     

Share This Page