Announcement

Collapse
No announcement yet.

URL Rewrite and/or Redirect assistance needed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] URL Rewrite and/or Redirect assistance needed

    Hi,

    question for those that are versed in .htaccess files and redirection-

    I just moved my vB suite install from a folder (www.mysite.com/forums) to the root.

    Also, I'm using the Mod Rewrite Friendly URL option, with the vbulletin-supplied .htaccess file.

    1) What's the best way to ensure external links will be able to reach the "new" location? Like for example, http://www.mysite.com/forums/threads...blah-blah-blah would automatically go to http://www.mysite.com/threads/1111-t...blah-blah-blah (same URL, just without the /forums)
    I tried a could of things that I found from google or whatever and just ended up getting 500 errors so figured I'd consult the experts here become continuing to experiment

    2) This request isn't as important as #1, but I also recently finally totally migrated my content from an old CMS system to vBulletin's CMS, and wanted to know if there's a simple way to redirect my article links..
    EX: one article was located at: http://mysite.com/index.php?option=c...-bio&Itemid=63, and the vbulletin CMS entry is at: http://www.mydomain.com/content/336-blah-blah-blah . I figured there isn't a rule that'll automatically change these URL's but I should at least be able to set up a permanant redirect for them in the .htaccess file, but messed that up also.

    My current .htaccess file looks like this, if it matters:

    Code:
    RewriteEngine on
    
    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>
    
    deny from 12.345.678.
    
    # If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
    # RewriteBase /forum/
    
    # If you are having problems with the rewrite from content/ to content.php, uncomment this line to turn MultiViews off.
    # Options -MultiViews
    
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    
    RewriteRule ^.*$ - [NC,L]
    
    # Forum
    RewriteRule ^threads/.* showthread.php [QSA]
    RewriteRule ^forums/.* forumdisplay.php [QSA]
    RewriteRule ^members/.* member.php [QSA]
    RewriteRule ^blogs/.* blog.php [QSA]
    RewriteRule ^entries/.* entry.php [QSA]
    
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    
    RewriteRule ^.*$ - [NC,L]
    
    # MVC
    RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
    (BTW, Yes, I replaced the deny IP address with a fake one, so don't be alarmed with that, lol)

    Thanks a lot for looking at this!
    Last edited by sportsfroma2; Mon 1st Aug '11, 5:16pm.

  • #2
    I think I figured out some of my problem-

    So when I had my site in the /forums folder, when I visited a forum, the URL was:
    http://www.mysite.com/forums/forumdisplay.php=17

    with mod rewrite enabled that became:
    http://www.mysite.com/forums/forums/17-Mods-Only-Forum

    Now with vbulletin in the root:

    with the same v-bulletin supplied mod_rewrite rules,

    the same link to the forum is:
    http://www.mysite.com/forums/17-Mods-Only-Forum

    So when I enable the mod_rewrite rule to strip the /forums out of all the old links (where there actually WAS a /forums directory), the "new" forum friendly link becomes http://www.mysite.com/17-Mods-Only-Forum (which obviously doesn't work).

    So, the workaround that I can think of is to change the vbulletin rewrite rules to make the new friendly URLs do something different that forums- maybe boards? so the new links would have a friendly URL of http://www.mysite.com/boards/17-Mods-Only-Forum

    Then, I can still continue to strip all the old /forums string out of all old links, right?

    so if I just want to change the new friendly forum URL's to /boards, would I just change:

    Code:
    RewriteRule ^forums/.* forumdisplay.php [QSA]
    to

    Code:
    RewriteRule ^boards/.* forumdisplay.php [QSA]
    ?

    Comment


    • #3
      Originally posted by sportsfroma2 View Post
      so if I just want to change the new friendly forum URL's to /boards, would I just change:

      Code:
      RewriteRule ^forums/.* forumdisplay.php [QSA]
      to

      Code:
      RewriteRule ^boards/.* forumdisplay.php [QSA]
      ?
      so just to keep it updated, incase anyonehere is reading this, that did not work.. Didn't change the URL any, just made the forums inaccessible (error 500)

      what gives?

      Comment


      • #4
        Grab the htaccess here.

        It supports friendly urls and covers the following Pagespeed Rules.

        Leverage browser caching
        Specify a cache validator
        Enable gzip compression

        Just copy the contents of that into your existing htaccess file (the one in your forum root if you have other htaccess files.)

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X