Mod Rewrite Friendly URLs => .htaccess

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Satviewers
    Member
    • Nov 2009
    • 54
    • 4.2.X

    Hi,

    I have integrated a shop into vb, when I put the .htaccess into the root folder the css and images and possible more stopped working.

    Basically if you go to www.example.com/osc_shop.php that file calls packages/shop/index.php or if you go to www.example.com/osc_install.php it calls packages/shop/osc_install/install.php

    Is there a way to get the RewriteRule to ignore the packages/shop/ folder, so that it can work as it originally did.
    Or is there a way to get the rewriteRule to work in this folder.

    If you could give me an example of how to get it to ignore the folder and how to add it, please.
    I will try to do the rest myself.

    Thanks.
    www.ezhost365.com

    Comment

    • kuyenmotdivad
      Senior Member
      • Apr 2006
      • 616
      • 4.1.x

      The ? are like wild cards - for example if you have a rewrite and want it to do the same eather http or https u'd rewrite like this.

      PHP Code:
      https
      Originally posted by the_webmaster
      I used to have this :

      PHP Code:
      RewriteEngine on
      # If you are having problems or are using VirtualDocumentRoot, uncomment  this line and set it to your vBulletin directory.
      # RewriteBase /forum/
      RewriteCond %{REQUEST_FILENAME} -[OR]
      RewriteCond %{REQUEST_FILENAME} -[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} -[OR]
      RewriteCond %{REQUEST_FILENAME} -[OR]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule 
      ^.*$ - [NC,L]
      # MVC
      RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$[QSA
      I removed it and used your htaccess.

      could you please tell me what the Different between them ? cause I do not have any clue

      Comment

      • SeToY
        Senior Member
        • Nov 2009
        • 100

        I gotta problem with this .htacces... When you're being redirected from the paypal donation-site, you're getting a vBulletin 404 "Not Found" error

        Comment

        • diogobguerreiro
          New Member
          • Feb 2010
          • 12
          • 4.0.0

          I used your .htaccess and it worked, but it happens that one thing missing. The accents are in the link.

          Example: www.forumdigitalfoto.com/forums/4-Câmeras-Reflex-Digitais-DSLR

          Instead of: www.forumdigitalfoto.com/forums/4-Cameras-Reflex-Digitais-DSLR

          How can I solve this problem?

          Comment

          • AndyPH
            New Member
            • Mar 2006
            • 13
            • 4.0.0

            Hello

            This .htaccess file seems to work for my forum with one exception, due to our individual situation.

            Previously our forum files were all in the /forums folder. With the upgrade to VB4, we've moved it back to the root folder. To ensure that all the old links to threads, etc, remained intact, we put a rewrite rule in the .htaccess file to redirect from /forums back to root for all links.

            Not that I have added all of the text from MattyAsia's .htaccess file, there is a clash, as it rewrites links with forumdisplay.php to be forums/, which our other rule tries to direct to root. Doh!

            Does anyone have an idea on how I could fix this? Or should I just go back to Advanced Friendly URLS?

            Here's the code. The highlighted lines are where the conflict occurs.
            Code:
            RewriteEngine on
            
            
            
            # Author: Matty Asia
            # Version 1.6
            # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
            
            RewriteEngine On
            Options +FollowSymLinks
            
            RewriteCond %{HTTP_HOST} ^xxxxxxxx.net$ [OR]
            RewriteCond %{HTTP_HOST} ^www.xxxxxxxx.net$
            [B][COLOR=Orange]RewriteRule ^forums\/?(.*)$ "http\:\/\/xxxxxxxx\.net\/$1" [R=301,L][/COLOR][/B]
            
            ### THIS IS A LITTLE EXTRA SECURITY AND CAN BE REMOVED
            
            RewriteRule ^includes/(.*) index.php
            RewriteRule ^vb/(.*) index.php
            RewriteRule ^packages/(.*) index.php
            
            ### THIS IS THE ACTUAL REWRITE
            
            RewriteRule ^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&%{QUERY_STRING}
            RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
            [COLOR=Orange][B]RewriteRule ^forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&%{QUERY_STRING}[/B][/COLOR]
            RewriteRule ^blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING}
            RewriteRule ^entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) entry.php?b=$1&page=$2&%{QUERY_STRING}
            RewriteRule ^lists/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
            RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
            RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING}
            Thank you
            Andy
            OZgolf.net Forums

            Comment

            • RedFoxy
              Senior Member
              • Sep 2007
              • 233

              Hi!
              I've a troubles with rewrite ("Mod Rewrite Friendly URLs" option) using \ in the title, the browser/server get it like a directory and give me a 404 error, I'm using that .htaccess:

              Code:
              RewriteEngine On
              Options +FollowSymLinks
              
              ####Charset
              AddDefaultCharset Off 
              
              ####Gzip
              <IfModule mod_rewrite.c>
              RewriteCond %{REQUEST_FILENAME} -f
              RewriteRule ^(.*)(js|css)$ /redir.php?file=$1$2&type=$2 [L]
              </IfModule>
              
              ####ETags
              FileETag None
              
              #
              # Sitemap rewrite
              #
              
              RewriteRule ^((urllist|sitemap)_.*\.(xml|txt)(\.gz)?)$ /sitemapxml/vbulletin_sitemap_index.xml.gz [L]
              RewriteRule ^((urllist|sitemap)*\.(xml|txt)(\.gz)?)$ /sitemapxml/vbulletin_sitemap_index.xml.gz [L]
              
              
              ####Expires
              
              <IfModule mod_expires.c>
              ExpiresActive On
              ExpiresByType image/gif A2592000
              ExpiresByType image/jpeg A2592000
              ExpiresByType image/png A2592000
              ExpiresByType application/x-shockwave-flash A2592000
              ExpiresByType text/css A2592000
              ExpiresByType application/x-javascript A2592000
              </IfModule>
              
              
              #
              # MediaWiki
              #
              RewriteRule ^SAM-Wiki/(.*)$ /samwiki/index.php?title=$1 [PT,L,QSA]
              RewriteRule ^SAM-Wiki/*$ /samwiki/index.php [L,QSA]
              RewriteRule ^/samwiki/*$ /samwiki/index.php [L,QSA]
              
              #
              # Forum and CMS
              #
              
              # Author: Matty Asia
              # Version 1.6
              # Downloaded from: http://www.vbulletin.com/forum/showthread.php?325798
              
              
              ### THIS IS A LITTLE EXTRA SECURITY AND CAN BE REMOVED
              
              RewriteRule ^includes/(.*) index.php
              RewriteRule ^vb/(.*) index.php
              RewriteRule ^packages/(.*) index.php
              
              ### THIS IS THE ACTUAL REWRITE
              
              RewriteRule ^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&%{QUERY_STRING}
              RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
              RewriteRule ^forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&%{QUERY_STRING}
              RewriteRule ^blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING}
              RewriteRule ^entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) entry.php?b=$1&page=$2&%{QUERY_STRING}
              RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
              RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
              RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING}
              Just for example, i created a new topic with title "test\test" and the url is http://www.softairmania.it/threads/138861-test/test?p=2170201#post2170201 and it's invalid because I got a 404 error page

              Any ideas how to fix that trouble?
              Last edited by RedFoxy; Thu 11 Mar '10, 4:25pm.

              Comment

              • diosrl
                Member
                • Feb 2005
                • 32
                • 4.0.x

                So until this date, there's no official .htaccess file to use with the Mod Rewrite Friendly URLs option?

                Comment

                • Zachery
                  Former vBulletin Support
                  • Jul 2002
                  • 59097

                  There have been full htaccess files provided for apache 2 and IIS since 4.0.1 I believe.

                  Comment

                  • RedFoxy
                    Senior Member
                    • Sep 2007
                    • 233

                    the .htaccess that i found under do_not_upload\rewrite\apache2 is fully compatible with "Mod Rewrite Friendly URLs" option?

                    I noticed that in that file there aren't nothing about list, content and widget/config is it normal?

                    Comment

                    • lifanovsky
                      Senior Member
                      • Oct 2004
                      • 269
                      • 4.0.0

                      Strange question. But did someone who turned on friendly URL's found that his or her forum started to be indexed more well with SE or did it help in some other way? I'm just thinking of turning this on and am not sure if its worth it...
                      Boris Lifanovsky; administrator of the biggest Russian classical music forum

                      Lifanovsky.com | ForumKlassika.Ru

                      Comment

                      • the_webmaster
                        Member
                        • Oct 2002
                        • 39

                        Originally posted by lifanovsky
                        Strange question. But did someone who turned on friendly URL's found that his or her forum started to be indexed more well with SE or did it help in some other way? I'm just thinking of turning this on and am not sure if its worth it...
                        not strange at all.. I couldn't find out any benefit from using it. on other hand I lost my sub-forum indexing in Google search.

                        might I'm wrong . but this is my point of view

                        I'm still looking for how to get back my sub-forums back in google search result
                        http://www.shmmr.net/vb/images/image...ar_add2007.gif

                        Comment

                        • RedFoxy
                          Senior Member
                          • Sep 2007
                          • 233

                          ok I'm using now the official .htaccess and look all good...

                          No one know how to explain at google which links I wanna show in google's sitelink?

                          Comment

                          • obmob
                            Senior Member
                            • Sep 2001
                            • 278

                            After enabling mod rewrite, is it normal that an old url is kept and not rewritten or redirected?

                            I mean, I can access a url like this


                            Instead I'd expect it to look like this:


                            Am i wrong in my assupmtion? Or the rewrite rules only apply while browsing the site?
                            Currently working on:
                            Anizeen - What anime have you seen?
                            Osito Barrigón - Winnie Pooh y sus Amigos

                            Comment

                            • zipperty
                              Member
                              • Mar 2010
                              • 37

                              Woiks great on my shared hosting - thanks

                              Comment

                              • burntire
                                Member
                                • Jun 2006
                                • 87
                                • 4.0.0

                                Originally posted by Bergler
                                Still having some issues and the error url is this http://www.mysite.com/forums/forums/...er-Information any ideas as to why it has forums in twice?
                                Has anyone worked this out I have the forums/forums issue.
                                www.highperformancestangs.com

                                Comment

                                Related Topics

                                Collapse

                                Working...