![]() |
Custom SEO urls (mod_rewrite only)
1 Attachment(s)
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} 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} 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:
Notes
|
Tagged for future use.
|
This seems to be more of an article ;)
But useful information none the less! |
Quote:
|
Good Mod. Waiting for live demo.:up:
|
Quote:
|
Tagged. :)
|
Do you plan to add forums.domain.com in the future? I would be extremely happy if you do.
|
I'm not sure if its possible; however I have an idea how it might be possible to get it to work.
Edit: Tested my idea; it is at least in theory possible to have forums.example.com; if you set the path to http://forums.yourdomain.com/threads (for threads) the urls will be correct; but i've not idea how to get the rewrites working for it... |
I see this as an article, too. Nevertheless it's tagged for future use ;)
|
ok; it is doable, however theres an aditional edit that needs to be made around line 604 find:
PHP Code:
PHP Code:
PHP Code:
|
I've updated the first post with a product and uploadable file which will allow customisations from the admincp (without requiring file edits to vbulletin php files)
|
Great work looks easy and just waiting on the bugs to be worked out.
|
You could always assist with that process by installing it in a development enviroment and seeing if you can find some bugs :P
|
Oops re-read and the default mod rewrite won't work as I get the 500 errors right now.
|
What version of apache are you running?
|
does this work with 4.0.1 as i don't seem to see any new options in the and admincp when i install the product
|
The options are listed under settings -> options -> Friendly URL settings.
|
Quote:
|
For some reason, the settings fields were missing from the product file :S the phrases for them were there but the options themselves weren't...
Please try the latest version, alpha 3 and see if the settings now appear. |
Options are there now and it works great,
by the way the settings menu is called "Custom Friendly URL Settings" (link: YOURDOMAIN/admincp/options.php?do=options&dogroup=imhotek_custom_urls _settinggroup) Thanks |
thanks for the update, but trying to get subdomains working and can't find the code to edit in class_friendly_url.php
|
Checklist:
1. Are you editing the file that came with vb (the file that this mod ships with is called class_custom_friendly_url.php and is not the one you need to edit :)) 2. Try using your text editor's find function the text sting ' // REQUEST_URI is dependable for apache' only appears once in the file and is a couple of lines above the one you need to edit. 3. Its possible that vb4.0.1 has something slightly different there; once I upgrade later this evening i'll check this. |
its a good idea to have a custom seo urls. Can we create custom urls such as sitename.com/thread-title-threadid.html as vbseo offers?
|
There aren't enough hooks in the friendly url class to achieve that much customisation at the moment.
@shai gar: I've just upgraded my board to 4.0.1; they've changed a good deal of code in class_friendly_url.php It seems the file edit isn't required now. Try following the instructions without making the file edit and see if it works (It worked fine on my dev board without) |
thank you :) looks cute , works cute , it is cute
|
Quote:
|
Please also consider adding categoryTitle to thread links, something like domain.com/categoryTitle-id/threadTitle-id
|
how can i let default vbseo urls..on vb4 without using vbseo?
|
@winstone:
Currently I can achieve that for forums + subforums only. Doing it for threads, appears to need a database query. Which is just unacceptable considering the number of urls a typical page builds. @cloferba: What are the default vbSEO links? |
I know this one might be a bit of a long shot, but would there be some way to set things up so that each category on the CMS could itself go on a separate subdomain, so we could do things like splitting up news and content sections?
|
@mukashi: Not with the current version; i've not really touched upon how to customise cms urls as they are handled differently from forum urls. It's something i'll probably look at in the future however.
I've been playing around with whats possible. Currently i've managed to flip the id and the title around sucessfully. As well as including the forum name in the url for threads. I'm hoping to bring quite a bit of customisation in the future for forum urls. |
Added a file to the zip which gets uploaded to the admincp. This file does a best guess generation of rewrite rules for you.
|
trying to get working with subdomain.domain.com
but i have a problem with this step: 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. setting it (site name/url/contact details) changes whole vbulletins default domain. help? i want to open home with domain.com and forums with subdomain |
Quote:
I know it's a lot of work and there are other ways to do it as well, maybe by checking all the cached templates and rewriting all matched urls is easier, in any case i'll defiantly do this or might give up n go with vbseo even tho its a rip off (IMO) |
Quote:
Quote:
Quote:
Quote:
|
it's possible to replace forums ids with names?
for example: domain.com/forums/10 to: domain.com/forums/off-topic |
hmm looks nice /threads/forum/topic
can we rewrite it as /forum-f<id>/topic-t<id>.html ? or /forum/<id>-topic |
Quote:
Thanks for sharing your thoughts and the code, I haven't started on working on URL rewrites and SEO yet but I will soon VB should have used one single router and one single method to create links, but what's been released is a mess. I call vbSEO rip off when comparing it with other community softwares out there which provide very good SEO tools for free and the cost for vbSEO is almost the same as what you would pay to buy those softwares, otherwise I'm not questioning it's functionalities |
Quote:
Quote:
Quote:
Quote:
I almost wonder if IB have got some deal with vbSEO not to kill them off; it took so long to get friendly urls in the core package and even with them in there, the functionallity is so lacking. While developing this i've been constantly amased at how easy it was to get most functionlity working. To get it working perfectly requires a few file edits, but vb could have made them. I intend to keep making improvments to this product including the amount of customisation avaliable and hopefully expanding to other areas eg the CMS untill vb improve the friendly urls in the core product. |
All times are GMT. The time now is 01:39 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|