The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Custom SEO urls (mod_rewrite only) Details »» | |||||||||||||||||||||||||||||||
What does this do?
This mod allows you to define the beginning part of all the friendly urls. Eventually, more of the url may be customizable but this should be enough to provide a nice structure to your site anyway. I have now released this as more of a mod to make it easier for the less technical admins. What use is this to me? I can see a couple of major uses here. 1. If you want to translate the friendly urls into your local language (so instead of having http://example.com/threads/123-Test-Thread/ you have http://example.com/[translation]/123-Test-thread) 2. You want a bit more structure to your links eg forum/threads, forum/posts, blogs/entries etc 3. You just don't like the defaults you've been stuck with and want to change to t,p,f,b and e Installation 1. First step here, is to ensure that the default mod rewrite urls work for you. Upload the default .htaccess file from the do_not_upload folder to your forums and switch on mod rewrite friendly urls in the server settings and optimisations area of your control panel. 2.Browse around your forums and check that all the links still work. (If they don't you need to work with vb support and your host to get them working) 3. Upload the contents of the upload folder in the zip. 4. Import the product. 5. There is now a new option group in your admin cp; friendly url settings. Change these to your liking. 5a. There is also a link to the rewrite rule generator from the settings page; once you've got the settings to your liking, visit the link to generate a .htaccess file. Alternativly follow the instructions below to make your own. 6. Once you've made these changes, you need to edit your .htaccess file rewrite rules to reflect the changes you made. You need to replicate the change to this file that you've made to the options. you will see a set of: Code:
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} 7. (Optional) Extra credit. Some people want the /forums/ to point to the forumindex page and /blogs/ to point to blog.php the following rewrite rules will take care of this. These should be added to the .htaccess file (don't overwrite any existing rules, these are new ones) Code:
RewriteRule ^forums/(index.php)?$ forum.php?%{QUERY_STRING} RewriteRule ^blogs/(index.php)?$ blog.php?%{QUERY_STRING} forums.domain.com and blogs.domain.com support This is not quite as easy as the above and requires a file edit to achieve. If you are using 4.0.1; you can skip the file edit part as it appears to work without. 1. Make a backup copy of includes/class_friendly_url.php 2. Around line 604 find: PHP Code:
PHP Code:
PHP Code:
4. In the vbulletin control panel set the cookie domain to be .yourdomain.com I dont know if this will have any knock on effects elsewhere, but it seems to be working for me on my dev board. 5. You can now set a value for forums to be http://forums.domain.com and blogs to be http://blogs.domain.com or similar based upon your requirement. 6. Rewrite rules are a bit more complex for this setup; this is a good resource for getting the server side stuff setup: http://www.reconn.us/content/view/46/67/ example rewrite rules: Code:
RewriteCond %{HTTP_HOST} ^(www.)?forums.domain.com$ [NC] 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 ^/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&%{QUERY_STRING} RewriteRule ^/(index.php)?$ forum.php?%{QUERY_STRING} RewriteCond %{HTTP_HOST} ^(www.)?blogs.domain.com$ [NC] RewriteRule ^entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) entry.php?b=$1&page=$2&%{QUERY_STRING} RewriteRule ^/(index.php)?$ blog.php?%{QUERY_STRING} RewriteRule ^/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING}
Notes
Download Now
Screenshots
Show Your Support
|
Благодарность от: | ||
Naijasite |
Comments |
#62
|
|||
|
|||
Thank you Carnage
|
#63
|
|||
|
|||
This is working great for me up to a point, but what I'd really like now is a way to remove the forum number in the friendly URL.
i.e., right now it is showing: http://mydomain.com/forums/forum/1234-the-forum-title and I'd like it to just say: http://mydomain.com/forums/forum/the-forum-title Anyone know a way to do this? It doesn't have to be part of the product, if someone can tell me what .php file to change and where, and what to put in .htaccess, that would work for me too. thanks very much~ |
#64
|
|||
|
|||
can't do that unfortunatly. Vb needs the number in order to identify which forum/thread is being accessed.
|
#65
|
|||
|
|||
Quote:
from: http://mydomain.com/members/1234-UserName to: http://mydomain.com/members/UserName Getting rid of the user number. There is underlying code already there to work without the number. http://mydomain.com/member.php?username=UserName What would be needed is a similar change to forum.php to process parameter forumname=ForumName Then comes the corner case that ForumName is not a unique key. vbSEO handles this by moving the forumid to the other side of the slash. from: http://mydomain.com/forum/1234-the-forum-title to: http://mydomain.com/f1234/the-forum-title |
#66
|
|||
|
|||
This is excellent stuff!
What/Where is necessary to change to enable.. from: http://mydomain.com/album.php?u=1234 to: http://mydomain.com/members/UserName/albums Then from: http://mydomain.com/album.php?albumid=345 to: http://mydomain.com/members/UserName/albums/AlbumName Finally from: http://mydomain.com/album.php?albumi...tachmentid=456 to: http://mydomain.com/members/UserName...56-PictureName ? |
#67
|
|||
|
|||
The member one might be doable then, however you already identified the issue with doing the same for forum names and thread titles -> the titles are not unique.
As for moving the forumid to the other side of the slash, take a look at the code in the experimental zip i uploaded; there is at lease one example in there that shows how to do things like that. (your url would probably end up as forums/1234/forum-title thou; this can be changed but requires substantially more work) album rewriting is not supported at all by vbulletin atm, I'm personally hoping that this is because they plan to give albums a major overhaul in 4.1 so didn't bother changing anything in 4.0 |
#68
|
|||
|
|||
i have a problem, when i write blog.xxxx.net this is the main forum, no blog.php
this is my htaccess: Code:
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} RewriteCond %{HTTP_HOST} ^(www.)?forum.xxxx.net$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?blog.xxxx.net$ [NC] RewriteRule ^/(index.php)?$ blog.php?%{QUERY_STRING} RewriteRule ^/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING} RewriteRule ^forums/(index.php)?$ forum.php?%{QUERY_STRING} RewriteRule ^blogs/(index.php)?$ blog.php?%{QUERY_STRING} also i need to edit this: http://www.vbulletin.com/forum/proje...?issueid=37477 in my template, for relative path url changes :/ |
#69
|
|||
|
|||
Just a brief look at your htaccess, i think its somewhat wrong. Try this instead:
Code:
RewriteCond %{HTTP_HOST} ^(www.)?forum.xxxx.net$ [NC] 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 ^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} RewriteCond %{HTTP_HOST} ^(www.)?blog.xxxx.net$ [NC] RewriteRule ^/(index.php)?$ blog.php?%{QUERY_STRING} RewriteRule ^/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING} RewriteRule ^forums/(index.php)?$ forum.php?%{QUERY_STRING} RewriteRule ^blogs/(index.php)?$ blog.php?%{QUERY_STRING} |
#70
|
|||
|
|||
Hi there, thanks for this add-on which seems to solve some of the mess i had with the default URLs.
I keep getting one problem and maybe it could be solved by editing rewrites or something else along this mod ? My Unregistered user is being redirected from http://www.example.com to http://www.example.com/content/ In fact the "Home section" leads to this /content/ whereas i would like it to be clean (root). Which basically means i have no canonical URL to share. The only place i can see i could edit is here but it says "leave them as are": Code:
#these rules can't be edited by my mod, so leave them as are. RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING} RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING} RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING} Any idea ? Thanks for your attention and keep up the good work :up: |
#71
|
|||
|
|||
Unfortunatly, I've not yet figured out a clean way of editing the urls generated by the CMS; it seems to require a huge amount of editing of php files to get anywhere.
As for your other problem; I've got that set to work on my development board, but I don't remember how :s What are the values for the settings CMS url and default page under content management? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|