1 ma2t Dec 31, 2005 23:24
3 ma2t Dec 31, 2005 23:44
This sounds great! many thanks for the detailed and quick reply. Although I do have one more question, im not sure if it will work though :/, sorry I didn't mention this before.
I plan to have another index.php running in the root, ie not b2evo, but as you stated I will need to leave the index.php there for b2evo so I guess this will not work.
Any way around this, maybe via a htaccess redirect? or something :-/
Cheers again :)
4 stk Jan 01, 2006 00:30
Ma2T -
Well, if you you're gonna use another index.php file in your root, then your b2evo blog will need to be started from a stub file, rather than index.php. This isn't a big deal, but you won't be able to keep your links in the format you want:
http://aliciakeysfan.com/index.php/2005/11/18/alicia_keys_fights_with_mom_helped_songw
(see the index.php off of root in the link? ... that's the b2evo index.php).
You're starting to get into "mutually exclusive" ground now, as you can't have your cake and eat it too (i.e., you're not going to be able to keep the links the same if you want a non-b2evo index.php to fire off at the root level).
Sounds like you have a decision ... which is more important ... keeping the links the same, or using a different index.php on root?
If you change b2evo to a stub file (a stub is basically like an index.php file, only it's named whatever you want) ... the links will look like this instead:
http://aliciakeysfan.com/[stub].php/2005/11/18/alicia_keys_fights_with_mom_helped_songw
Similar, but they will change.
Hope this helps. (If the other index file is a HTML rather than a PHP file, i *believe* both can live in the same folder ... the HTML will be the one that comes up automatically (as it will be *found* first), but the php file (explicitly called) can point to the b2evo blog. If they're both PHP files ... then you're going to have a conflict. I haven't tested this theory, so it may be all wet.)
-stk :D
5 ma2t Jan 01, 2006 17:51
Many Thanks for the great help stk, you have explained everything perfectly, and yes I am indeed left with a decision, not an easy one :/
I have been thinking, I was looking at my google Analytics (great and now free btw :) ) information and found that over half of my visitors come directly to another page, ie a thread / topic rather than the main page, this is why I don't want all these links in google to become useless and go no where, or I would loose many of my visitors.
As you stated, unfortinaly I can't keep the links the same, as they use index.php :/, thats a bad thing :(, I was thinking though, is there a way to direct all these page requests to either the NEW url (i plan to use shorter links) or directly to the home page? This way I wouldn't loose many of my visitors (the worst outcome)
Many Thanks :)
Matt
6 stk Jan 02, 2006 00:29
Ma2T,
I would think that the best option would be a "custom error page". Until the search engines are able to crawl the new URLs and get them indexed, visitors are going to be using the old (dead) links.
When they do, they'll get a [404 Page not Found] error.
Most hosts allow you to create custom error pages, which is a good way of NOT LOSING VISITORS when they click a dead link.
It's not as good as redirecting to the new (correct) URL, but it will (at least) direct visitors to your menu and let them know that the link they clicked no longer works.
We employ a custom error page on our site ... which you can try out by just typing in http://randsco.com/someFileThatIsNotReal.html and you'll see that we (at least) provide a menu that let's you navigate to our home page.
I don't really know what to recommend, as you can only have one index.php as default on root and you just have to choose. I don't know how long it would take the search engines to pick up the new URLs, but i can't imagine that it would be longer than a month.
Good luck! :D
-stk
7 juzzwuzzz Jan 02, 2006 14:27
Maybe this is something... don't know.. I am new to b2evo, so I don't know if it works for you, but it looks like the same problem you have
http://thunder.prohosting.com/~sampieri/freefaq/g_htaccess.shtml#redirect
And especially this part
URL Redirection
You can redirect URLs using a CGI, or using a META Refresh tag in the header of an HTML page. But you can also do so from an .htaccess file. Why? It's faster for the server to do the redirect then to run a CGI or load a web page with a META Refresh tag in it, which some browsers may not support.Why redirect? Suppose you have an old page that's been around for a while, and maybe it's in a few search engines. But you want to change the structure of your site and rename some pages. Instead of worrying about people coming to your site from search engines or old bookmarks, you can put a line in a .htaccess file for each page you want to redirect users from. The format is like this:
RedirectPermanent OLDPAGE NEWURL
For example:RedirectPermanent /~username/mypage.html http://free.prohosting.com/~username/otherpage.html
Now when the user goes to your site to the "mypage.html" page, the server automatically redirects them to the new page. Also, the old page, "mypage.html", does not actually have to exist, so you can remove old pages and save account space.You can redirect entire directories by only specifying the old directory name and the new directory name in each URL. The filename that is entered is appended to the redirected URL, as needed. For example:
RedirectPermanent /~username http://free.prohosting.com/~username/otherdir
Then, someone browsing http://thunder.prohosting.com/~username will be redirected to http://thunder.prohosting.com/~username/otherdir.
8 stk Jan 02, 2006 15:24
Ma2T,
You know what? Juzzwuzzz's htaccess redirect (using htaccess) might just work for you, but it's gonna be a bit of work on your part. (Good info Juzzwuzzz ... ;) )
Here's why ...
I kept thinking about the 2nd part (redirecting whole directories), knowing that you wouldn't be able to say:
RedirectPermanent http://aliciakeysfan/index.php
http://aliciakeysfan/[newDir]/index.php
BECAUSE of the conflict of having a NEW index.php file at the root level.
HOWEVER ... you *might* be able to pick on subdirectory changes instead, which would make for a longer list, but could achieve what you wanted. For example ... instead of the above redirect (which has conflicts with the new index.php file) you could try:
RedirectPermanent http://aliciakeysfan/index.php/2005
http://aliciakeysfan/[newDir]/index.php/2005
The idea being that anyone that requested a 2005 article, would be redirected to the new URL. (I don't know how many years-worth of articles you have, but I can't imagine that it would be too many lines in an htaccess file).
Give that a whirl and see if it does what you want! (Maybe you CAN have your cake and eat it too?)
Hope this helps.
-stk :D
PS - It's still good practice to use custom error pages and redirect lost visitors to a navigable menu (rather than a generic, can't-do-anything, 404-File Not Found page).
EDIT - Hmmm ... I tried to do this using htaccess on my site and ran into nothing but server errors.
2nd EDIT - Got it. I was having problems with the syntax. Following the rules set forth [url=http://httpd.apache.org/docs/1.3/mod/mod_alias.html]HERE[/url] I was able to redirect all my 2005 entries to another file using the following syntax (so ... bottom line ... looks like this *might* do what you want - of course, you'd want to redirect to another DIRECTORY, rather than a single FILE ... but the idea is the same).
Redirect 302 /index.php/2005 http://randsco.com/adventures.html
The 302 is a "temporary" redirect ... you can use either "301" (i.e., permanent) or use the "RedirectPermanent" mod_alias command ... the key for me was knowing that it all had to be ON THE SAME LINE (the examples above made it look like 2 lines, which didnt work and only led to server errors).
I think, in your case, the Redirect command would look more like
RedirectPermanent /index.php/2005 http://aliciakeysfan/[newB2evoDir]/index.php/2005
RedirectPermanent /index.php/2004 http://aliciakeysfan/[newB2evoDir]/index.php/2004
...
You might even get fancy and do it all on one line, using a RedirectMatch command (if you're up on REGEX ... you could probably catch all of the possible year combinations with a simple REGEX statement). If not ... a few lines would work too. ;)
Hope this helps!
-stk :D
9 ma2t Jan 02, 2006 17:53
Wow thank you both very much :D, some great information there and seems like we might have come up with a good solution, many thanks for the info on htaccess Juzzwuzzz :)
I have posts from 2002-2006 I guess, but like you say I guess that wont be too many lines of code, if its just one line for each year or so. I guess it works recursively for all posts in that year?, im sure it can.
Also good advice about the custom error page, I checked yours out and it seems like a great idea :)
I run another site which has a lot of htaccess redirects, although I didn't make them myself lol, maybe I can take a look at them and work out how it works. Thanks for testing the code stk, you have been extreemly helpful! many thanks, I guess it's just some small thing that needs to be changed to get it working right, for everything below the 2005 or 2004 etc folder.
Whoah, just noticed you edited again :o :D, many thanks for the codes! and also the link, looks pretty damn perfect!, this would solve my problem for sure. lol maybe I could do it via REGEX, but 5 lines or so should be good old, keep it simple for my simple mind lol!
Many Thanks yet again for all the help! you have been extreemly helpful stk! :D Can't wait to give this a shot :D
Cheers
10 personman May 05, 2006 21:58
Does anyone know how to do this (store the app files in a subdir but keep index.php and stubs in the web root) using b2evolution 1.8? The conf/_advanced.php file is quite a bit different now. I've tried a few things, but my results have been inconsistent at best.
11 personman May 05, 2006 23:50
EDIT: This is still casuing a few problems. There was an error on the page for editing a user's settings. I finally gave up and moved all the files to the web root.
stk helped me with this via IM. The _advanced.php file looks a bit different, but the steps are basically the same as before if you want to do this for version 1.8. Now I have the blog app files moved into a sub folder of my web root. Permalinks on blogs and the backoffice seem to work just fine.
1. Set the baseurl to your web root.
2. Put index.php in the web root and edit the part at the bottom that points to the config file. Add your subdir into that path.
3. Edit /conf/_advanced.php and add your subdir into the values for $conf_subdir, $inc_subdir, $htsrv_subdir, $xmlsrv_subdir, $rsc_subdir, $skins_subdir, $locales_subdir, $plugins_subdir, $install_subdir and $media_subdir .
4. Leave the $dispatcher line as it is, but right below it, put your directory in like this: $admin_url = $baseurl.'yourdir/'.$dispatcher;
So far that seems to be working for me. Thanks, stk!
12 stk May 06, 2006 03:33
No problemo. Glad to help you get it sorted (and take a peek at v1.8) :D
Cheers,
PS ... Thanks for the vote! ;) (Now I have more than Blabba) :o
You can do what you want.
Create your dir ... move b2evo files BUT do the following.
1) Leave your index.php and any stub files in the root dir. They'll need to be edited to point to the new location for the "let b2evolution do the rest" part (adding the new /dir/ to the path).
2) You don't need to modify the $baseurl variable, as it will remain the same (root), BUT you will need to modify /conf/_advanced.php to tell the program WHERE the new subdirectories are located and how to back out of them ...
They'll be a bunch of pairs like this:
and you'll need to add the [bracketed] pieces (minus the brackets).
Hope that helps.
-stk :D
PS ... this is the setup for our system, as the index.php file is found at http://randsco.com, but the b2evolution stuff is in a subdirectory off of root. (Keeps the root directory tidy ;) )